Added ball graphics to Xcode project, which fixes the Go game. Fixed Tic-Tac-Toe. Fixed an exception in the demo app when changing games.
authorsnej@snej.local
Sun Jan 11 00:02:27 2009 -0800 (2009-01-11)
changeset 26e7a464fb6d39
parent 25 b53fa38013fc
child 27 b0affce7beb1
Added ball graphics to Xcode project, which fixes the Go game. Fixed Tic-Tac-Toe. Fixed an exception in the demo app when changing games.
GeekGameBoard.xcodeproj/project.pbxproj
Source/DemoBoardView.m
Source/KlondikeGame.m
Source/TicTacToeGame.h
Source/TicTacToeGame.m
     1.1 --- a/GeekGameBoard.xcodeproj/project.pbxproj	Fri Nov 21 09:31:57 2008 -0800
     1.2 +++ b/GeekGameBoard.xcodeproj/project.pbxproj	Sun Jan 11 00:02:27 2009 -0800
     1.3 @@ -32,6 +32,14 @@
     1.4  		276DFC570D00890C00D329AE /* Yellow Ball.png in Resources */ = {isa = PBXBuildFile; fileRef = 276DFC540D00890C00D329AE /* Yellow Ball.png */; };
     1.5  		276DFC580D00890C00D329AE /* White Ball.png in Resources */ = {isa = PBXBuildFile; fileRef = 276DFC550D00890C00D329AE /* White Ball.png */; };
     1.6  		2795C2B80CC278C800D7B2BD /* Piece.m in Sources */ = {isa = PBXBuildFile; fileRef = 2795C2B70CC278C800D7B2BD /* Piece.m */; };
     1.7 +		2796EA270F194FF7003B8806 /* ball-black.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA1F0F194FF7003B8806 /* ball-black.png */; };
     1.8 +		2796EA280F194FF7003B8806 /* ball-cyan.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA200F194FF7003B8806 /* ball-cyan.png */; };
     1.9 +		2796EA290F194FF7003B8806 /* ball-gray.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA210F194FF7003B8806 /* ball-gray.png */; };
    1.10 +		2796EA2A0F194FF7003B8806 /* ball-green.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA220F194FF7003B8806 /* ball-green.png */; };
    1.11 +		2796EA2B0F194FF7003B8806 /* ball-orange.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA230F194FF7003B8806 /* ball-orange.png */; };
    1.12 +		2796EA2C0F194FF7003B8806 /* ball-purple.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA240F194FF7003B8806 /* ball-purple.png */; };
    1.13 +		2796EA2D0F194FF7003B8806 /* ball-red.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA250F194FF7003B8806 /* ball-red.png */; };
    1.14 +		2796EA2E0F194FF7003B8806 /* ball-white.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA260F194FF7003B8806 /* ball-white.png */; };
    1.15  		279F4D870D8606C200B32DBF /* GGBLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 279F4D840D8606C200B32DBF /* GGBLayer.m */; };
    1.16  		279F4D880D8606C200B32DBF /* GGBTextLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 279F4D860D8606C200B32DBF /* GGBTextLayer.m */; };
    1.17  		279F4DB20D8607AD00B32DBF /* O.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 279F4DB00D8607AD00B32DBF /* O.tiff */; };
    1.18 @@ -97,6 +105,14 @@
    1.19  		276DFC550D00890C00D329AE /* White Ball.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "White Ball.png"; path = "Resources/White Ball.png"; sourceTree = "<group>"; };
    1.20  		2795C2B60CC278C800D7B2BD /* Piece.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Piece.h; sourceTree = "<group>"; };
    1.21  		2795C2B70CC278C800D7B2BD /* Piece.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Piece.m; sourceTree = "<group>"; };
    1.22 +		2796EA1F0F194FF7003B8806 /* ball-black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-black.png"; sourceTree = "<group>"; };
    1.23 +		2796EA200F194FF7003B8806 /* ball-cyan.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-cyan.png"; sourceTree = "<group>"; };
    1.24 +		2796EA210F194FF7003B8806 /* ball-gray.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-gray.png"; sourceTree = "<group>"; };
    1.25 +		2796EA220F194FF7003B8806 /* ball-green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-green.png"; sourceTree = "<group>"; };
    1.26 +		2796EA230F194FF7003B8806 /* ball-orange.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-orange.png"; sourceTree = "<group>"; };
    1.27 +		2796EA240F194FF7003B8806 /* ball-purple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-purple.png"; sourceTree = "<group>"; };
    1.28 +		2796EA250F194FF7003B8806 /* ball-red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-red.png"; sourceTree = "<group>"; };
    1.29 +		2796EA260F194FF7003B8806 /* ball-white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-white.png"; sourceTree = "<group>"; };
    1.30  		279F4D830D8606C200B32DBF /* GGBLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GGBLayer.h; sourceTree = "<group>"; };
    1.31  		279F4D840D8606C200B32DBF /* GGBLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GGBLayer.m; sourceTree = "<group>"; };
    1.32  		279F4D850D8606C200B32DBF /* GGBTextLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GGBTextLayer.h; sourceTree = "<group>"; };
    1.33 @@ -269,6 +285,22 @@
    1.34  			path = Resources/Gingko;
    1.35  			sourceTree = "<group>";
    1.36  		};
    1.37 +		2796EA1E0F194FF7003B8806 /* Balls */ = {
    1.38 +			isa = PBXGroup;
    1.39 +			children = (
    1.40 +				2796EA1F0F194FF7003B8806 /* ball-black.png */,
    1.41 +				2796EA200F194FF7003B8806 /* ball-cyan.png */,
    1.42 +				2796EA210F194FF7003B8806 /* ball-gray.png */,
    1.43 +				2796EA220F194FF7003B8806 /* ball-green.png */,
    1.44 +				2796EA230F194FF7003B8806 /* ball-orange.png */,
    1.45 +				2796EA240F194FF7003B8806 /* ball-purple.png */,
    1.46 +				2796EA250F194FF7003B8806 /* ball-red.png */,
    1.47 +				2796EA260F194FF7003B8806 /* ball-white.png */,
    1.48 +			);
    1.49 +			name = Balls;
    1.50 +			path = Resources/Balls;
    1.51 +			sourceTree = "<group>";
    1.52 +		};
    1.53  		29B97314FDCFA39411CA2CEA /* BoardGame */ = {
    1.54  			isa = PBXGroup;
    1.55  			children = (
    1.56 @@ -296,6 +328,7 @@
    1.57  		29B97317FDCFA39411CA2CEA /* Resources */ = {
    1.58  			isa = PBXGroup;
    1.59  			children = (
    1.60 +				2796EA1E0F194FF7003B8806 /* Balls */,
    1.61  				275167D30DEE2AB000247375 /* Gingko */,
    1.62  				29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
    1.63  				8D1107310486CEB800E47090 /* Info.plist */,
    1.64 @@ -379,6 +412,14 @@
    1.65  				275167DB0DEE2AB000247375 /* Green.png in Resources */,
    1.66  				275167DC0DEE2AB000247375 /* Red.png in Resources */,
    1.67  				275167DD0DEE2AB000247375 /* Violet.png in Resources */,
    1.68 +				2796EA270F194FF7003B8806 /* ball-black.png in Resources */,
    1.69 +				2796EA280F194FF7003B8806 /* ball-cyan.png in Resources */,
    1.70 +				2796EA290F194FF7003B8806 /* ball-gray.png in Resources */,
    1.71 +				2796EA2A0F194FF7003B8806 /* ball-green.png in Resources */,
    1.72 +				2796EA2B0F194FF7003B8806 /* ball-orange.png in Resources */,
    1.73 +				2796EA2C0F194FF7003B8806 /* ball-purple.png in Resources */,
    1.74 +				2796EA2D0F194FF7003B8806 /* ball-red.png in Resources */,
    1.75 +				2796EA2E0F194FF7003B8806 /* ball-white.png in Resources */,
    1.76  			);
    1.77  			runOnlyForDeploymentPostprocessing = 0;
    1.78  		};
     2.1 --- a/Source/DemoBoardView.m	Fri Nov 21 09:31:57 2008 -0800
     2.2 +++ b/Source/DemoBoardView.m	Sun Jan 11 00:02:27 2009 -0800
     2.3 @@ -49,19 +49,23 @@
     2.4  
     2.5  - (void) startGameNamed: (NSString*)gameClassName
     2.6  {
     2.7 +    [self.game removeObserver: self 
     2.8 +           forKeyPath: @"currentPlayer"];
     2.9 +    [self.game removeObserver: self
    2.10 +           forKeyPath: @"winner"];
    2.11 +
    2.12      [super startGameNamed: gameClassName];
    2.13      
    2.14 -    Game *game = self.game;
    2.15 -    [game addObserver: self 
    2.16 +    [self.game addObserver: self 
    2.17             forKeyPath: @"currentPlayer"
    2.18                options: NSKeyValueObservingOptionInitial
    2.19                context: NULL];
    2.20 -    [game addObserver: self
    2.21 +    [self.game addObserver: self
    2.22             forKeyPath: @"winner"
    2.23                options: 0 
    2.24                context: NULL];
    2.25      
    2.26 -    self.window.title = [(id)[game class] displayName];
    2.27 +    self.window.title = [(id)[self.game class] displayName];
    2.28  }
    2.29  
    2.30  
     3.1 --- a/Source/KlondikeGame.m	Fri Nov 21 09:31:57 2008 -0800
     3.2 +++ b/Source/KlondikeGame.m	Sun Jan 11 00:02:27 2009 -0800
     3.3 @@ -190,5 +190,4 @@
     3.4  }
     3.5  
     3.6  
     3.7 -
     3.8  @end
     4.1 --- a/Source/TicTacToeGame.h	Fri Nov 21 09:31:57 2008 -0800
     4.2 +++ b/Source/TicTacToeGame.h	Sun Jan 11 00:02:27 2009 -0800
     4.3 @@ -28,7 +28,6 @@
     4.4      See: http://en.wikipedia.org/wiki/Tic-tac-toe */
     4.5  @interface TicTacToeGame : Game {
     4.6      RectGrid *_grid;
     4.7 -    Dispenser *_dispenser[2];
     4.8  }
     4.9  
    4.10  @end
     5.1 --- a/Source/TicTacToeGame.m	Fri Nov 21 09:31:57 2008 -0800
     5.2 +++ b/Source/TicTacToeGame.m	Sun Jan 11 00:02:27 2009 -0800
     5.3 @@ -58,23 +58,6 @@
     5.4      _grid.cellColor = CreateGray(1.0, 0.25);
     5.5      _grid.lineColor = kTranslucentLightGrayColor;
     5.6      [_table addSublayer: _grid];
     5.7 -    
     5.8 -    // Create piece dispensers for the two players:
     5.9 -    for( int playerNumber=0; playerNumber<=1; playerNumber++ ) {
    5.10 -        Piece *p = [self pieceForPlayer: playerNumber];
    5.11 -        CGFloat x = floor(CGRectGetMidX(_table.bounds));
    5.12 -#if TARGET_OS_IPHONE
    5.13 -        x = x - 80 + 160*playerNumber;
    5.14 -        CGFloat y = 360;
    5.15 -#else
    5.16 -        x += (playerNumber==0 ?-230 :230);
    5.17 -        CGFloat y = 175;
    5.18 -#endif
    5.19 -        [_dispenser[playerNumber] release];
    5.20 -        _dispenser[playerNumber] = [[Dispenser alloc] initWithPrototype: p quantity: 0
    5.21 -                                                                  frame: CGRectMake(x-45,y-45, 90,90)];
    5.22 -        [_table addSublayer: _dispenser[playerNumber]];
    5.23 -    }            
    5.24  }
    5.25  
    5.26  
    5.27 @@ -109,7 +92,7 @@
    5.28  - (Bit*) bitToPlaceInHolder: (id<BitHolder>)holder
    5.29  {
    5.30      if( holder.bit==nil && [holder isKindOfClass: [Square class]] )
    5.31 -        return _dispenser[self.currentPlayer.index].bit;
    5.32 +        return [self pieceForPlayer: self.currentPlayer.index];
    5.33      else
    5.34          return nil;
    5.35  }
    5.36 @@ -123,15 +106,6 @@
    5.37      [super bit: bit movedFrom: src to: dst];
    5.38  }
    5.39  
    5.40 -/* FIX: Need to restore this somehow, now that -nextPlayer is gone
    5.41 -- (void) nextPlayer
    5.42 -{
    5.43 -    [super nextPlayer];
    5.44 -    // Give the next player another piece to put down:
    5.45 -    _dispenser[self.currentPlayer.index].quantity = 1;
    5.46 -}
    5.47 - */
    5.48 -
    5.49  static Player* ownerAt( Grid *grid, int index )
    5.50  {
    5.51      return [grid cellAtRow: index/3 column: index%3].bit.owner;