Changeset 936 for trunk/macosx


Ignore:
Timestamp:
Sep 27, 2006, 8:34:17 PM (15 years ago)
Author:
livings124
Message:

Generate the pieces images in code rather than using files.

Location:
trunk/macosx
Files:
6 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/PiecesView.m

    r935 r936  
    2626        for (i = 0; i < numPieces; i++)
    2727            fPieces[i] = BLANK;
    28        
    29         fBack = [NSImage imageNamed: @"PiecesBack.tiff"];
    30         NSSize size = [fBack size];
    31        
    32         fWhitePiece = [NSImage imageNamed: @"BoxWhite.tiff"];
    33         [fWhitePiece setScalesWhenResized: YES];
    34         [fWhitePiece setSize: size];
    35        
    36         fGreenPiece = [NSImage imageNamed: @"BoxGreen.tiff"];
    37         [fGreenPiece setScalesWhenResized: YES];
    38         [fGreenPiece setSize: size];
    39        
    40         fBlue1Piece = [NSImage imageNamed: @"BoxBlue1.tiff"];
    41         [fBlue1Piece setScalesWhenResized: YES];
    42         [fBlue1Piece setSize: size];
    43        
    44         fBlue2Piece = [NSImage imageNamed: @"BoxBlue2.tiff"];
    45         [fBlue2Piece setScalesWhenResized: YES];
    46         [fBlue2Piece setSize: size];
    47        
    48         fBlue3Piece = [NSImage imageNamed: @"BoxBlue3.tiff"];
    49         [fBlue3Piece setScalesWhenResized: YES];
    50         [fBlue3Piece setSize: size];
    51        
     28    }
     29   
     30    return self;
     31}
     32
     33- (void) awakeFromNib
     34{
     35        NSSize size = [fImageView frame].size;
     36        NSBezierPath * bp = [NSBezierPath bezierPathWithRect: [fImageView bounds]];
     37       
     38        //back image
     39        fBack = [[NSImage alloc] initWithSize: size];
     40       
     41        [fBack lockFocus];
     42        [[NSColor blackColor] set];
     43        [bp fill];
     44        [fBack unlockFocus];
     45       
     46        //white box image
     47        fWhitePiece = [[NSImage alloc] initWithSize: size];
     48       
     49        [fWhitePiece lockFocus];
     50        [[NSColor whiteColor] set];
     51        [bp fill];
     52        [fWhitePiece unlockFocus];
     53       
     54        //green box image
     55        fGreenPiece = [[NSImage alloc] initWithSize: size];
     56       
     57        [fGreenPiece lockFocus];
     58        [[NSColor colorWithCalibratedRed: 0.557 green: 0.992 blue: 0.639 alpha: 1.0] set];
     59        [bp fill];
     60        [fGreenPiece unlockFocus];
     61       
     62        //blue 1 box image
     63        fBlue1Piece = [[NSImage alloc] initWithSize: size];
     64       
     65        [fBlue1Piece lockFocus];
     66        [[NSColor colorWithCalibratedRed: 0.777 green: 0.906 blue: 1.0 alpha: 1.0] set];
     67        [bp fill];
     68        [fBlue1Piece unlockFocus];
     69       
     70        //blue 2 box image
     71        fBlue2Piece = [[NSImage alloc] initWithSize: size];
     72       
     73        [fBlue2Piece lockFocus];
     74        [[NSColor colorWithCalibratedRed: 0.682 green: 0.839 blue: 1.0 alpha: 1.0] set];
     75        [bp fill];
     76        [fBlue2Piece unlockFocus];
     77       
     78        //blue 3 box image
     79        fBlue3Piece = [[NSImage alloc] initWithSize: size];
     80       
     81        [fBlue3Piece lockFocus];
     82        [[NSColor colorWithCalibratedRed: 0.506 green: 0.745 blue: 1.0 alpha: 1.0] set];
     83        [bp fill];
     84        [fBlue3Piece unlockFocus];
     85       
     86        //actually draw the box
    5287        [self setTorrent: nil];
    53     }
    54    
    55     return self;
    5688}
    5789
Note: See TracChangeset for help on using the changeset viewer.