# HG changeset patch # User Jens Alfke # Date 1216230544 25200 # Node ID ed057f4a72ca7727ca9254a3a973ed21dc6fbe51 # Parent ccc5ed68222d79f09e2c12c22fe2fa808e5e3fba Full-screen improvements (Your Move bug #12). Gameboard resize doesn't animate, making it less laggy. diff -r ccc5ed68222d -r ed057f4a72ca GeekGameBoard-iPhone.xcodeproj/project.pbxproj --- a/GeekGameBoard-iPhone.xcodeproj/project.pbxproj Mon Jul 14 21:46:09 2008 -0700 +++ b/GeekGameBoard-iPhone.xcodeproj/project.pbxproj Wed Jul 16 10:49:04 2008 -0700 @@ -425,6 +425,7 @@ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jens Alfke"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_DYNAMIC_NO_PIC = NO; @@ -441,6 +442,7 @@ 1D6058950D05DD3E006BFB54 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jens Alfke"; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; diff -r ccc5ed68222d -r ed057f4a72ca Source/BoardUIView.m --- a/Source/BoardUIView.m Mon Jul 14 21:46:09 2008 -0700 +++ b/Source/BoardUIView.m Wed Jul 16 10:49:04 2008 -0700 @@ -68,7 +68,7 @@ [rootLayer addSublayer: _gameboard]; [_gameboard release]; - _game = [[gameClass alloc] initNewGameWithBoard: _gameboard]; + _game = [[gameClass alloc] initNewGameWithTable: _gameboard]; } diff -r ccc5ed68222d -r ed057f4a72ca Source/BoardView.h --- a/Source/BoardView.h Mon Jul 14 21:46:09 2008 -0700 +++ b/Source/BoardView.h Wed Jul 16 10:49:04 2008 -0700 @@ -28,6 +28,7 @@ /** NSView that hosts a game. */ @interface BoardView : NSView { + IBOutlet NSView *_fullScreenView; // View to use as root of full-screen mode @private Game *_game; // Current Game GGBLayer *_table; // Game's root layer diff -r ccc5ed68222d -r ed057f4a72ca Source/BoardView.m --- a/Source/BoardView.m Mon Jul 14 21:46:09 2008 -0700 +++ b/Source/BoardView.m Wed Jul 16 10:49:04 2008 -0700 @@ -110,16 +110,22 @@ } +- (NSView*) fullScreenView +{ + return _fullScreenView ?: self; +} + + - (IBAction) enterFullScreen: (id)sender { - [self _removeGameBoard]; - if( self.isInFullScreenMode ) { - [self exitFullScreenModeWithOptions: nil]; + //[self _removeGameBoard]; + if( self.fullScreenView.isInFullScreenMode ) { + [self.fullScreenView exitFullScreenModeWithOptions: nil]; } else { - [self enterFullScreenMode: self.window.screen - withOptions: nil]; + [self.fullScreenView enterFullScreenMode: self.window.screen + withOptions: nil]; } - [self createGameBoard]; + //[self createGameBoard]; } @@ -135,7 +141,9 @@ if( _oldSize.width > 0.0f ) { CGAffineTransform xform = _table.affineTransform; xform.a = xform.d = MIN(newSize.width,newSize.height)/MIN(_oldSize.width,_oldSize.height); + BeginDisableAnimations(); _table.affineTransform = xform; + EndDisableAnimations(); } else [self createGameBoard]; } @@ -152,12 +160,16 @@ #pragma mark KEY EVENTS: -- (void) keyDown: (NSEvent*)ev +- (BOOL) performKeyEquivalent: (NSEvent*)ev { - if( self.isInFullScreenMode ) { - if( [ev.charactersIgnoringModifiers hasPrefix: @"\033"] ) // Esc key - [self enterFullScreen: self]; + if( [ev.charactersIgnoringModifiers hasPrefix: @"\033"] ) { // Esc key + if( self.fullScreenView.isInFullScreenMode ) { + [self performSelector: @selector(enterFullScreen:) withObject: nil afterDelay: 0.0]; + // without the delayed-perform, NSWindow crashes right after this method returns! + return YES; + } } + return NO; }