mirror of
https://github.com/libretro/RetroArch
synced 2025-03-26 11:37:30 +00:00
(UI CocoaTouch) Implement toggle
This commit is contained in:
parent
f040d2c841
commit
7c47695f37
@ -43,6 +43,7 @@ const void* apple_get_frontend_settings(void);
|
||||
+ (RetroArch_iOS*)get;
|
||||
|
||||
- (void)showGameView;
|
||||
- (void)toggleUI;
|
||||
|
||||
- (void)loadingCore:(NSString*)core withFile:(const char*)file;
|
||||
- (void)unloadingCore;
|
||||
|
@ -362,16 +362,19 @@ enum
|
||||
[[UIApplication sharedApplication] setIdleTimerDisabled:true];
|
||||
[self.window setRootViewController:[RAGameView get]];
|
||||
|
||||
runloop->is_paused = false;
|
||||
runloop->is_idle = false;
|
||||
runloop->is_paused = false;
|
||||
runloop->is_idle = false;
|
||||
runloop->ui_companion_is_on_foreground = false;
|
||||
}
|
||||
|
||||
- (IBAction)showPauseMenu:(id)sender
|
||||
{
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
|
||||
runloop->is_paused = true;
|
||||
runloop->is_idle = true;
|
||||
runloop->is_paused = true;
|
||||
runloop->is_idle = true;
|
||||
runloop->ui_companion_is_on_foreground = true;
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:false withAnimation:UIStatusBarAnimationNone];
|
||||
[[UIApplication sharedApplication] setIdleTimerDisabled:false];
|
||||
[self.window setRootViewController:self];
|
||||
@ -385,6 +388,20 @@ enum
|
||||
[self showGameView];
|
||||
}
|
||||
|
||||
- (void)toggleUI
|
||||
{
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
|
||||
if (runloop->ui_companion_is_on_foreground)
|
||||
{
|
||||
[self showGameView];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self showPauseMenu:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)unloadingCore
|
||||
{
|
||||
[self showPauseMenu:self];
|
||||
|
@ -46,6 +46,7 @@ typedef struct runloop
|
||||
/* Lifecycle state checks. */
|
||||
bool is_paused;
|
||||
bool is_idle;
|
||||
bool ui_companion_is_on_foreground;
|
||||
bool is_menu;
|
||||
bool is_slowmotion;
|
||||
|
||||
|
@ -53,6 +53,16 @@ static void ui_companion_cocoatouch_notify_content_loaded(void *data)
|
||||
[ap showGameView];
|
||||
}
|
||||
|
||||
static void ui_companion_cocoatouch_toggle(void *data)
|
||||
{
|
||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||
|
||||
(void)data;
|
||||
|
||||
if (ap)
|
||||
[ap toggleUI];
|
||||
}
|
||||
|
||||
static int ui_companion_cocoatouch_iterate(void *data, unsigned action)
|
||||
{
|
||||
(void)data;
|
||||
@ -84,7 +94,7 @@ const ui_companion_driver_t ui_companion_cocoatouch = {
|
||||
ui_companion_cocoatouch_init,
|
||||
ui_companion_cocoatouch_deinit,
|
||||
ui_companion_cocoatouch_iterate,
|
||||
NULL,
|
||||
ui_companion_cocoatouch_toggle,
|
||||
ui_companion_cocoatouch_notify_content_loaded,
|
||||
"cocoatouch",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user