Source/BoardUIView.h
author Jens Alfke <jens@mooseyard.com>
Sun Mar 16 15:06:47 2008 -0700 (2008-03-16)
changeset 7 428a194e3e59
permissions -rw-r--r--
Game class now tracks board state and moves, as strings, and can step through its history.
Fixed another bug in Go (you could drag your captured stones back to the board!)
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