Source/CheckersGame.m
changeset 2 7b0441db81e5
parent 0 e9f7ba4718e1
child 7 428a194e3e59
     1.1 --- a/Source/CheckersGame.m	Fri Mar 07 11:43:02 2008 -0800
     1.2 +++ b/Source/CheckersGame.m	Mon Mar 10 17:32:04 2008 -0700
     1.3 @@ -24,6 +24,7 @@
     1.4  #import "Grid.h"
     1.5  #import "Piece.h"
     1.6  #import "QuartzUtils.h"
     1.7 +#import "GGBUtils.h"
     1.8  
     1.9  
    1.10  @implementation CheckersGame
    1.11 @@ -64,8 +65,8 @@
    1.12      grid.position = pos;
    1.13      grid.allowsMoves = YES;
    1.14      grid.allowsCaptures = NO;
    1.15 -    grid.cellColor = CGColorCreateGenericGray(0.0, 0.25);
    1.16 -    grid.altCellColor = CGColorCreateGenericGray(1.0, 0.25);
    1.17 +    grid.cellColor = CreateGray(0.0, 0.25);
    1.18 +    grid.altCellColor = CreateGray(1.0, 0.25);
    1.19      grid.lineColor = nil;
    1.20      [self addPieces: @"Green Ball.png" toGrid: grid forPlayer: 0 rows: NSMakeRange(0,3) alternating: YES];
    1.21      [self addPieces: @"Red Ball.png"   toGrid: grid forPlayer: 1 rows: NSMakeRange(5,3) alternating: YES];
    1.22 @@ -73,7 +74,7 @@
    1.23  }
    1.24  
    1.25  
    1.26 -- (id) initWithBoard: (CALayer*)board
    1.27 +- (id) initWithBoard: (GGBLayer*)board
    1.28  {
    1.29      self = [super initWithBoard: board];
    1.30      if (self != nil) {
    1.31 @@ -102,12 +103,12 @@
    1.32      int playerIndex = self.currentPlayer.index;
    1.33      BOOL isKing = ([bit valueForKey: @"King"] != nil);
    1.34      
    1.35 -    [[NSSound soundNamed: (isKing ?@"Funk" :@"Tink")] play];
    1.36 +    PlaySound(isKing ?@"Funk" :@"Tink");
    1.37  
    1.38      // "King" a piece that made it to the last row:
    1.39      if( dst.row == (playerIndex ?0 :7) )
    1.40          if( ! isKing ) {
    1.41 -            [[NSSound soundNamed: @"Blow"] play];
    1.42 +            PlaySound(@"Blow");
    1.43              bit.scale = 1.4;
    1.44              [bit setValue: @"King" forKey: @"King"];
    1.45              // don't set isKing flag - piece can't jump again after being kinged.
    1.46 @@ -125,7 +126,7 @@
    1.47          capture = src.br;
    1.48      
    1.49      if( capture ) {
    1.50 -        [[NSSound soundNamed: @"Pop"] play];
    1.51 +        PlaySound(@"Pop");
    1.52          Bit *bit = capture.bit;
    1.53          _numPieces[bit.owner.index]--;
    1.54          [bit destroy];