Source/BoardUIView.h
author Jens Alfke <jens@mooseyard.com>
Thu Jul 31 13:23:44 2008 -0700 (2008-07-31)
changeset 23 efe5d4523a23
permissions -rw-r--r--
* Fixed scaling of king pieces when the board's state is set.
* Added IBOutlets for tilting the BoardView.
jens@1
     1
//
jens@1
     2
//  BoardUIView.h
jens@1
     3
//  GeekGameBoard
jens@1
     4
//
jens@1
     5
//  Created by Jens Alfke on 3/7/08.
jens@1
     6
//  Copyright 2008 __MyCompanyName__. All rights reserved.
jens@1
     7
//
jens@1
     8
jens@1
     9
#import <UIKit/UIKit.h>
jens@1
    10
@class GGBLayer, Bit, Card, Grid, Game;
jens@1
    11
@protocol BitHolder;
jens@1
    12
jens@1
    13
jens@1
    14
/** NSView that hosts a game. */
jens@1
    15
@interface BoardUIView : UIView
jens@1
    16
{
jens@1
    17
    @private
jens@1
    18
    Game *_game;                                // Current Game
jens@1
    19
    GGBLayer *_gameboard;                       // Game's main layer
jens@1
    20
    
jens@1
    21
    // Used during mouse-down tracking:
jens@1
    22
    CGPoint _dragStartPos;                      // Starting position of mouseDown
jens@1
    23
    Bit *_dragBit;                              // Bit being dragged
jens@1
    24
    id<BitHolder> _oldHolder;                   // Bit's original holder
jens@1
    25
    CALayer *_oldSuperlayer;                    // Bit's original superlayer
jens@1
    26
    int _oldLayerIndex;                         // Bit's original index in _oldSuperlayer.layers
jens@1
    27
    CGPoint _oldPos;                            // Bit's original x/y position
jens@1
    28
    CGPoint _dragOffset;                        // Offset of mouse position from _dragBit's origin
jens@1
    29
    BOOL _dragMoved;                            // Has the mouse moved more than 3 pixels since mouseDown?
jens@1
    30
    id<BitHolder> _dropTarget;                  // Current BitHolder the cursor is over
jens@1
    31
    
jens@1
    32
    // Used while handling incoming drags:
jens@1
    33
    GGBLayer *_viewDropTarget;                   // Current drop target during an incoming drag-n-drop
jens@1
    34
}
jens@1
    35
jens@1
    36
- (void) startGameNamed: (NSString*)gameClassName;
jens@1
    37
jens@1
    38
@property (readonly) Game *game;
jens@1
    39
@property (readonly) GGBLayer *gameboard;
jens@1
    40
jens@1
    41
- (CGRect) gameBoardFrame;
jens@1
    42
jens@1
    43
@end