Source/BoardUIView.h
author Jens Alfke <jens@mooseyard.com>
Thu May 29 15:04:06 2008 -0700 (2008-05-29)
changeset 9 a59acc683080
permissions -rw-r--r--
Finally fixed the slow animation performance of board games; all it took was changing the board's z index from 1 to 0, somehow. Games working well now.
     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