Full-screen improvements (Your Move bug #12).
authorJens Alfke <jens@mooseyard.com>
Wed Jul 16 10:49:04 2008 -0700 (2008-07-16)
changeset 18ed057f4a72ca
parent 17 ccc5ed68222d
child 19 3b750982ff39
Full-screen improvements (Your Move bug #12).
Gameboard resize doesn't animate, making it less laggy.
GeekGameBoard-iPhone.xcodeproj/project.pbxproj
Source/BoardUIView.m
Source/BoardView.h
Source/BoardView.m
     1.1 --- a/GeekGameBoard-iPhone.xcodeproj/project.pbxproj	Mon Jul 14 21:46:09 2008 -0700
     1.2 +++ b/GeekGameBoard-iPhone.xcodeproj/project.pbxproj	Wed Jul 16 10:49:04 2008 -0700
     1.3 @@ -425,6 +425,7 @@
     1.4  		1D6058940D05DD3E006BFB54 /* Debug */ = {
     1.5  			isa = XCBuildConfiguration;
     1.6  			buildSettings = {
     1.7 +				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jens Alfke";
     1.8  				COPY_PHASE_STRIP = NO;
     1.9  				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
    1.10  				GCC_DYNAMIC_NO_PIC = NO;
    1.11 @@ -441,6 +442,7 @@
    1.12  		1D6058950D05DD3E006BFB54 /* Release */ = {
    1.13  			isa = XCBuildConfiguration;
    1.14  			buildSettings = {
    1.15 +				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jens Alfke";
    1.16  				COPY_PHASE_STRIP = YES;
    1.17  				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
    1.18  				GCC_ENABLE_FIX_AND_CONTINUE = NO;
     2.1 --- a/Source/BoardUIView.m	Mon Jul 14 21:46:09 2008 -0700
     2.2 +++ b/Source/BoardUIView.m	Wed Jul 16 10:49:04 2008 -0700
     2.3 @@ -68,7 +68,7 @@
     2.4      [rootLayer addSublayer: _gameboard];
     2.5      [_gameboard release];
     2.6      
     2.7 -    _game = [[gameClass alloc] initNewGameWithBoard: _gameboard];
     2.8 +    _game = [[gameClass alloc] initNewGameWithTable: _gameboard];
     2.9  }
    2.10  
    2.11  
     3.1 --- a/Source/BoardView.h	Mon Jul 14 21:46:09 2008 -0700
     3.2 +++ b/Source/BoardView.h	Wed Jul 16 10:49:04 2008 -0700
     3.3 @@ -28,6 +28,7 @@
     3.4  /** NSView that hosts a game. */
     3.5  @interface BoardView : NSView
     3.6  {
     3.7 +    IBOutlet NSView *_fullScreenView;           // View to use as root of full-screen mode
     3.8      @private
     3.9      Game *_game;                                // Current Game
    3.10      GGBLayer *_table;                           // Game's root layer
     4.1 --- a/Source/BoardView.m	Mon Jul 14 21:46:09 2008 -0700
     4.2 +++ b/Source/BoardView.m	Wed Jul 16 10:49:04 2008 -0700
     4.3 @@ -110,16 +110,22 @@
     4.4  }
     4.5  
     4.6  
     4.7 +- (NSView*) fullScreenView
     4.8 +{
     4.9 +    return _fullScreenView ?: self;
    4.10 +}
    4.11 +
    4.12 +
    4.13  - (IBAction) enterFullScreen: (id)sender
    4.14  {
    4.15 -    [self _removeGameBoard];
    4.16 -    if( self.isInFullScreenMode ) {
    4.17 -        [self exitFullScreenModeWithOptions: nil];
    4.18 +    //[self _removeGameBoard];
    4.19 +    if( self.fullScreenView.isInFullScreenMode ) {
    4.20 +        [self.fullScreenView exitFullScreenModeWithOptions: nil];
    4.21      } else {
    4.22 -        [self enterFullScreenMode: self.window.screen 
    4.23 -                      withOptions: nil];
    4.24 +        [self.fullScreenView enterFullScreenMode: self.window.screen 
    4.25 +                                     withOptions: nil];
    4.26      }
    4.27 -    [self createGameBoard];
    4.28 +    //[self createGameBoard];
    4.29  }
    4.30  
    4.31  
    4.32 @@ -135,7 +141,9 @@
    4.33      if( _oldSize.width > 0.0f ) {
    4.34          CGAffineTransform xform = _table.affineTransform;
    4.35          xform.a = xform.d = MIN(newSize.width,newSize.height)/MIN(_oldSize.width,_oldSize.height);
    4.36 +        BeginDisableAnimations();
    4.37          _table.affineTransform = xform;
    4.38 +        EndDisableAnimations();
    4.39      } else
    4.40          [self createGameBoard];
    4.41  }
    4.42 @@ -152,12 +160,16 @@
    4.43  #pragma mark KEY EVENTS:
    4.44  
    4.45  
    4.46 -- (void) keyDown: (NSEvent*)ev
    4.47 +- (BOOL) performKeyEquivalent: (NSEvent*)ev
    4.48  {
    4.49 -    if( self.isInFullScreenMode ) {
    4.50 -        if( [ev.charactersIgnoringModifiers hasPrefix: @"\033"] )       // Esc key
    4.51 -            [self enterFullScreen: self];
    4.52 +    if( [ev.charactersIgnoringModifiers hasPrefix: @"\033"] ) {       // Esc key
    4.53 +        if( self.fullScreenView.isInFullScreenMode ) {
    4.54 +            [self performSelector: @selector(enterFullScreen:) withObject: nil afterDelay: 0.0];
    4.55 +            // without the delayed-perform, NSWindow crashes right after this method returns!
    4.56 +            return YES;
    4.57 +        }
    4.58      }
    4.59 +    return NO;
    4.60  }
    4.61  
    4.62