# HG changeset patch # User snej@snej.local # Date 1231660947 28800 # Node ID e7a464fb6d39c224a08bbda8286b49d29beff56c # Parent b53fa38013fca90c2752fa557ab39a62a0d363d0 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. diff -r b53fa38013fc -r e7a464fb6d39 GeekGameBoard.xcodeproj/project.pbxproj --- a/GeekGameBoard.xcodeproj/project.pbxproj Fri Nov 21 09:31:57 2008 -0800 +++ b/GeekGameBoard.xcodeproj/project.pbxproj Sun Jan 11 00:02:27 2009 -0800 @@ -32,6 +32,14 @@ 276DFC570D00890C00D329AE /* Yellow Ball.png in Resources */ = {isa = PBXBuildFile; fileRef = 276DFC540D00890C00D329AE /* Yellow Ball.png */; }; 276DFC580D00890C00D329AE /* White Ball.png in Resources */ = {isa = PBXBuildFile; fileRef = 276DFC550D00890C00D329AE /* White Ball.png */; }; 2795C2B80CC278C800D7B2BD /* Piece.m in Sources */ = {isa = PBXBuildFile; fileRef = 2795C2B70CC278C800D7B2BD /* Piece.m */; }; + 2796EA270F194FF7003B8806 /* ball-black.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA1F0F194FF7003B8806 /* ball-black.png */; }; + 2796EA280F194FF7003B8806 /* ball-cyan.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA200F194FF7003B8806 /* ball-cyan.png */; }; + 2796EA290F194FF7003B8806 /* ball-gray.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA210F194FF7003B8806 /* ball-gray.png */; }; + 2796EA2A0F194FF7003B8806 /* ball-green.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA220F194FF7003B8806 /* ball-green.png */; }; + 2796EA2B0F194FF7003B8806 /* ball-orange.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA230F194FF7003B8806 /* ball-orange.png */; }; + 2796EA2C0F194FF7003B8806 /* ball-purple.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA240F194FF7003B8806 /* ball-purple.png */; }; + 2796EA2D0F194FF7003B8806 /* ball-red.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA250F194FF7003B8806 /* ball-red.png */; }; + 2796EA2E0F194FF7003B8806 /* ball-white.png in Resources */ = {isa = PBXBuildFile; fileRef = 2796EA260F194FF7003B8806 /* ball-white.png */; }; 279F4D870D8606C200B32DBF /* GGBLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 279F4D840D8606C200B32DBF /* GGBLayer.m */; }; 279F4D880D8606C200B32DBF /* GGBTextLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 279F4D860D8606C200B32DBF /* GGBTextLayer.m */; }; 279F4DB20D8607AD00B32DBF /* O.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 279F4DB00D8607AD00B32DBF /* O.tiff */; }; @@ -97,6 +105,14 @@ 276DFC550D00890C00D329AE /* White Ball.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "White Ball.png"; path = "Resources/White Ball.png"; sourceTree = ""; }; 2795C2B60CC278C800D7B2BD /* Piece.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Piece.h; sourceTree = ""; }; 2795C2B70CC278C800D7B2BD /* Piece.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Piece.m; sourceTree = ""; }; + 2796EA1F0F194FF7003B8806 /* ball-black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-black.png"; sourceTree = ""; }; + 2796EA200F194FF7003B8806 /* ball-cyan.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-cyan.png"; sourceTree = ""; }; + 2796EA210F194FF7003B8806 /* ball-gray.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-gray.png"; sourceTree = ""; }; + 2796EA220F194FF7003B8806 /* ball-green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-green.png"; sourceTree = ""; }; + 2796EA230F194FF7003B8806 /* ball-orange.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-orange.png"; sourceTree = ""; }; + 2796EA240F194FF7003B8806 /* ball-purple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-purple.png"; sourceTree = ""; }; + 2796EA250F194FF7003B8806 /* ball-red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-red.png"; sourceTree = ""; }; + 2796EA260F194FF7003B8806 /* ball-white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ball-white.png"; sourceTree = ""; }; 279F4D830D8606C200B32DBF /* GGBLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GGBLayer.h; sourceTree = ""; }; 279F4D840D8606C200B32DBF /* GGBLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GGBLayer.m; sourceTree = ""; }; 279F4D850D8606C200B32DBF /* GGBTextLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GGBTextLayer.h; sourceTree = ""; }; @@ -269,6 +285,22 @@ path = Resources/Gingko; sourceTree = ""; }; + 2796EA1E0F194FF7003B8806 /* Balls */ = { + isa = PBXGroup; + children = ( + 2796EA1F0F194FF7003B8806 /* ball-black.png */, + 2796EA200F194FF7003B8806 /* ball-cyan.png */, + 2796EA210F194FF7003B8806 /* ball-gray.png */, + 2796EA220F194FF7003B8806 /* ball-green.png */, + 2796EA230F194FF7003B8806 /* ball-orange.png */, + 2796EA240F194FF7003B8806 /* ball-purple.png */, + 2796EA250F194FF7003B8806 /* ball-red.png */, + 2796EA260F194FF7003B8806 /* ball-white.png */, + ); + name = Balls; + path = Resources/Balls; + sourceTree = ""; + }; 29B97314FDCFA39411CA2CEA /* BoardGame */ = { isa = PBXGroup; children = ( @@ -296,6 +328,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 2796EA1E0F194FF7003B8806 /* Balls */, 275167D30DEE2AB000247375 /* Gingko */, 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, 8D1107310486CEB800E47090 /* Info.plist */, @@ -379,6 +412,14 @@ 275167DB0DEE2AB000247375 /* Green.png in Resources */, 275167DC0DEE2AB000247375 /* Red.png in Resources */, 275167DD0DEE2AB000247375 /* Violet.png in Resources */, + 2796EA270F194FF7003B8806 /* ball-black.png in Resources */, + 2796EA280F194FF7003B8806 /* ball-cyan.png in Resources */, + 2796EA290F194FF7003B8806 /* ball-gray.png in Resources */, + 2796EA2A0F194FF7003B8806 /* ball-green.png in Resources */, + 2796EA2B0F194FF7003B8806 /* ball-orange.png in Resources */, + 2796EA2C0F194FF7003B8806 /* ball-purple.png in Resources */, + 2796EA2D0F194FF7003B8806 /* ball-red.png in Resources */, + 2796EA2E0F194FF7003B8806 /* ball-white.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff -r b53fa38013fc -r e7a464fb6d39 Source/DemoBoardView.m --- a/Source/DemoBoardView.m Fri Nov 21 09:31:57 2008 -0800 +++ b/Source/DemoBoardView.m Sun Jan 11 00:02:27 2009 -0800 @@ -49,19 +49,23 @@ - (void) startGameNamed: (NSString*)gameClassName { + [self.game removeObserver: self + forKeyPath: @"currentPlayer"]; + [self.game removeObserver: self + forKeyPath: @"winner"]; + [super startGameNamed: gameClassName]; - Game *game = self.game; - [game addObserver: self + [self.game addObserver: self forKeyPath: @"currentPlayer" options: NSKeyValueObservingOptionInitial context: NULL]; - [game addObserver: self + [self.game addObserver: self forKeyPath: @"winner" options: 0 context: NULL]; - self.window.title = [(id)[game class] displayName]; + self.window.title = [(id)[self.game class] displayName]; } diff -r b53fa38013fc -r e7a464fb6d39 Source/KlondikeGame.m --- a/Source/KlondikeGame.m Fri Nov 21 09:31:57 2008 -0800 +++ b/Source/KlondikeGame.m Sun Jan 11 00:02:27 2009 -0800 @@ -190,5 +190,4 @@ } - @end diff -r b53fa38013fc -r e7a464fb6d39 Source/TicTacToeGame.h --- a/Source/TicTacToeGame.h Fri Nov 21 09:31:57 2008 -0800 +++ b/Source/TicTacToeGame.h Sun Jan 11 00:02:27 2009 -0800 @@ -28,7 +28,6 @@ See: http://en.wikipedia.org/wiki/Tic-tac-toe */ @interface TicTacToeGame : Game { RectGrid *_grid; - Dispenser *_dispenser[2]; } @end diff -r b53fa38013fc -r e7a464fb6d39 Source/TicTacToeGame.m --- a/Source/TicTacToeGame.m Fri Nov 21 09:31:57 2008 -0800 +++ b/Source/TicTacToeGame.m Sun Jan 11 00:02:27 2009 -0800 @@ -58,23 +58,6 @@ _grid.cellColor = CreateGray(1.0, 0.25); _grid.lineColor = kTranslucentLightGrayColor; [_table addSublayer: _grid]; - - // Create piece dispensers for the two players: - for( int playerNumber=0; playerNumber<=1; playerNumber++ ) { - Piece *p = [self pieceForPlayer: playerNumber]; - CGFloat x = floor(CGRectGetMidX(_table.bounds)); -#if TARGET_OS_IPHONE - x = x - 80 + 160*playerNumber; - CGFloat y = 360; -#else - x += (playerNumber==0 ?-230 :230); - CGFloat y = 175; -#endif - [_dispenser[playerNumber] release]; - _dispenser[playerNumber] = [[Dispenser alloc] initWithPrototype: p quantity: 0 - frame: CGRectMake(x-45,y-45, 90,90)]; - [_table addSublayer: _dispenser[playerNumber]]; - } } @@ -109,7 +92,7 @@ - (Bit*) bitToPlaceInHolder: (id)holder { if( holder.bit==nil && [holder isKindOfClass: [Square class]] ) - return _dispenser[self.currentPlayer.index].bit; + return [self pieceForPlayer: self.currentPlayer.index]; else return nil; } @@ -123,15 +106,6 @@ [super bit: bit movedFrom: src to: dst]; } -/* FIX: Need to restore this somehow, now that -nextPlayer is gone -- (void) nextPlayer -{ - [super nextPlayer]; - // Give the next player another piece to put down: - _dispenser[self.currentPlayer.index].quantity = 1; -} - */ - static Player* ownerAt( Grid *grid, int index ) { return [grid cellAtRow: index/3 column: index%3].bit.owner;