1
0
mirror of https://github.com/libretro/RetroArch synced 2025-04-03 01:21:10 +00:00

(iOS) Implement apple_stop_iteration too

This commit is contained in:
Twinaphex 2015-03-12 01:46:49 +01:00
parent 498fa2dd21
commit 9507bdcea7

@ -32,6 +32,8 @@
id<RetroArch_Platform> apple_platform; id<RetroArch_Platform> apple_platform;
CADisplayLink *displayLink;
/* forward decls */ /* forward decls */
void apple_rarch_exited(void); void apple_rarch_exited(void);
@ -288,6 +290,9 @@ static void rarch_main_event_pump(void)
{ {
int ret = 0; int ret = 0;
if (displayLink == nil)
goto exit;
rarch_main_event_pump(); rarch_main_event_pump();
ret = rarch_main_iterate(); ret = rarch_main_iterate();
@ -310,12 +315,15 @@ exit:
- (void) apple_start_iteration - (void) apple_start_iteration
{ {
[[CADisplayLink displayLinkWithTarget:self displayLink = [CADisplayLink displayLinkWithTarget:self
selector:@selector(rarch_draw:)] addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; selector:@selector(rarch_draw:)];
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
} }
- (void) apple_stop_iteration - (void) apple_stop_iteration
{ {
[displayLink removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
displayLink = nil;
} }
- (void)applicationDidEnterBackground:(UIApplication *)application - (void)applicationDidEnterBackground:(UIApplication *)application
@ -325,6 +333,7 @@ exit:
- (void)applicationWillTerminate:(UIApplication *)application - (void)applicationWillTerminate:(UIApplication *)application
{ {
[self apple_stop_iteration];
} }
- (void)applicationDidBecomeActive:(UIApplication *)application - (void)applicationDidBecomeActive:(UIApplication *)application