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