Source/BoardView.m
changeset 16 28392c9a969f
parent 15 73f8c889f053
child 18 ed057f4a72ca
     1.1 --- a/Source/BoardView.m	Wed Jul 09 17:07:45 2008 -0700
     1.2 +++ b/Source/BoardView.m	Mon Jul 14 21:00:15 2008 -0700
     1.3 @@ -38,7 +38,7 @@
     1.4  @implementation BoardView
     1.5  
     1.6  
     1.7 -@synthesize gameboard=_gameboard;
     1.8 +@synthesize table=_table;
     1.9  
    1.10  
    1.11  - (void) dealloc
    1.12 @@ -50,24 +50,24 @@
    1.13  
    1.14  - (void) _removeGameBoard
    1.15  {
    1.16 -    if( _gameboard ) {
    1.17 -        RemoveImmediately(_gameboard);
    1.18 -        _gameboard = nil;
    1.19 +    if( _table ) {
    1.20 +        RemoveImmediately(_table);
    1.21 +        _table = nil;
    1.22      }
    1.23  }
    1.24  
    1.25  - (void) createGameBoard
    1.26  {
    1.27      [self _removeGameBoard];
    1.28 -    _gameboard = [[CALayer alloc] init];
    1.29 -    _gameboard.frame = [self gameBoardFrame];
    1.30 -    _gameboard.autoresizingMask = kCALayerMinXMargin | kCALayerMaxXMargin | kCALayerMinYMargin | kCALayerMaxYMargin;
    1.31 +    _table = [[CALayer alloc] init];
    1.32 +    _table.frame = [self gameBoardFrame];
    1.33 +    _table.autoresizingMask = kCALayerMinXMargin | kCALayerMaxXMargin | kCALayerMinYMargin | kCALayerMaxYMargin;
    1.34  
    1.35      // Tell the game to set up the board:
    1.36 -    _game.board = _gameboard;
    1.37 +    _game.table = _table;
    1.38  
    1.39 -    [self.layer addSublayer: _gameboard];
    1.40 -    [_gameboard release];
    1.41 +    [self.layer addSublayer: _table];
    1.42 +    [_table release];
    1.43  }
    1.44  
    1.45  
    1.46 @@ -79,7 +79,7 @@
    1.47  - (void) setGame: (Game*)game
    1.48  {
    1.49      if( game!=_game ) {
    1.50 -        _game.board = nil;
    1.51 +        _game.table = nil;
    1.52          setObj(&_game,game);
    1.53          [self createGameBoard];
    1.54      }
    1.55 @@ -133,9 +133,9 @@
    1.56  {
    1.57      [super setFrameSize: newSize];
    1.58      if( _oldSize.width > 0.0f ) {
    1.59 -        CGAffineTransform xform = _gameboard.affineTransform;
    1.60 +        CGAffineTransform xform = _table.affineTransform;
    1.61          xform.a = xform.d = MIN(newSize.width,newSize.height)/MIN(_oldSize.width,_oldSize.height);
    1.62 -        _gameboard.affineTransform = xform;
    1.63 +        _table.affineTransform = xform;
    1.64      } else
    1.65          [self createGameBoard];
    1.66  }
    1.67 @@ -189,7 +189,7 @@
    1.68                     offset: (CGPoint*)outOffset
    1.69  {
    1.70      CGPoint where = [self _convertPointFromWindowToLayer: locationInWindow ];
    1.71 -    CALayer *layer = [_gameboard hitTest: where];
    1.72 +    CALayer *layer = [_table hitTest: where];
    1.73      while( layer ) {
    1.74          if( match(layer) ) {
    1.75              CGPoint bitPos = [self.layer convertPoint: layer.position