Set paused state when using the home button

This commit is contained in:
Dave Nicolson 2020-10-20 18:41:35 +02:00
parent 62a6eb0af7
commit d38f2c02f5
3 changed files with 5 additions and 0 deletions

View file

@ -122,6 +122,7 @@ bool iphoneControllerIsAvailable() {
} }
} }
#if !TARGET_OS_TV
setupPauseButtonHandler(controller); setupPauseButtonHandler(controller);
// Register for controller connected/disconnected notifications // Register for controller connected/disconnected notifications
@ -140,6 +141,7 @@ bool iphoneControllerIsAvailable() {
[ns addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { [ns addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
controller = nil; controller = nil;
}]; }];
#endif
} }
initialized = true; // Only need to do this once initialized = true; // Only need to do this once
} }

View file

@ -234,6 +234,7 @@ BOOL settingsMenuSelected = NO;
[ gAppDelegate ShowGLView ]; [ gAppDelegate ShowGLView ];
ResumeGame(); ResumeGame();
paused = false;
Sound_StartLocalSound( "iphone/baborted_01.wav" ); Sound_StartLocalSound( "iphone/baborted_01.wav" );
@ -596,6 +597,7 @@ BOOL settingsMenuSelected = NO;
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator { - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
if (!context.previouslyFocusedView && [context.nextFocusedView isKindOfClass:[Banner_SubItem class]]) { if (!context.previouslyFocusedView && [context.nextFocusedView isKindOfClass:[Banner_SubItem class]]) {
[ gAppDelegate HideGLView ]; [ gAppDelegate HideGLView ];
paused = true;
} }
} }

View file

@ -466,6 +466,7 @@ static const char * const MissionNames[TOTAL_EPISODES][9] = {
if (!context.previouslyFocusedView) { if (!context.previouslyFocusedView) {
[ gAppDelegate HideGLView ]; [ gAppDelegate HideGLView ];
paused = true;
} }
[super didUpdateFocusInContext:context withAnimationCoordinator:coordinator]; [super didUpdateFocusInContext:context withAnimationCoordinator:coordinator];