diff --git a/CMakeLists.txt b/CMakeLists.txt index 421b1596d6..e61186791d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -738,7 +738,7 @@ if(ANDROID) elseif(IOS) set(nativeExtra ${nativeExtra} ios/main.mm - ios/AppDelegate.m + ios/AppDelegate.mm ios/AppDelegate.h ios/ViewController.mm ios/ViewController.h @@ -752,7 +752,7 @@ elseif(IOS) set(nativeExtraLibs ${nativeExtraLibs} "-weak_framework GameController") endif() - set_source_files_properties(ios/AppDelegate.m PROPERTIES COMPILE_FLAGS -fobjc-arc) + set_source_files_properties(ios/AppDelegate.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) set_source_files_properties(ios/ViewController.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) set(TargetBin PPSSPP) diff --git a/ios/AppDelegate.m b/ios/AppDelegate.m deleted file mode 100644 index f2a6cced88..0000000000 --- a/ios/AppDelegate.m +++ /dev/null @@ -1,18 +0,0 @@ -// AppDelegate.m boilerplate - -#import "AppDelegate.h" - -#import "ViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.viewController = [[ViewController alloc] init]; - self.window.rootViewController = self.viewController; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/ios/AppDelegate.mm b/ios/AppDelegate.mm new file mode 100644 index 0000000000..7926aa5f8e --- /dev/null +++ b/ios/AppDelegate.mm @@ -0,0 +1,21 @@ +#import "AppDelegate.h" +#import "ViewController.h" +#import "base/NativeApp.h" + +@implementation AppDelegate +-(BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + self.viewController = [[ViewController alloc] init]; + self.window.rootViewController = self.viewController; + [self.window makeKeyAndVisible]; + return YES; +} + +-(void) applicationWillResignActive:(UIApplication *)application { + NativeMessageReceived("lost_focus", ""); +} + +-(void) applicationDidBecomeActive:(UIApplication *)application { + NativeMessageReceived("got_focus", ""); +} +@end \ No newline at end of file