IosO3DEApplicationDelegate.mm 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzFramework/API/ApplicationAPI_ios.h>
  9. #import <UIKit/UIKit.h>
  10. //[GFX TODO][ATOM-449] - Remove this file once we switch to unified launcher
  11. ////////////////////////////////////////////////////////////////////////////////////////////////////
  12. @interface IosO3DEApplicationDelegate : NSObject<UIApplicationDelegate>
  13. {
  14. }
  15. @end // IosO3DEApplicationDelegate Interface
  16. ////////////////////////////////////////////////////////////////////////////////////////////////////
  17. @implementation IosO3DEApplicationDelegate
  18. extern int ios_main();
  19. ////////////////////////////////////////////////////////////////////////////////////////////////////
  20. - (void)launchO3DEApplication
  21. {
  22. const int exitCode = ios_main();
  23. exit(exitCode);
  24. }
  25. ////////////////////////////////////////////////////////////////////////////////////////////////////
  26. - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
  27. {
  28. [self performSelector:@selector(launchO3DEApplication) withObject:nil afterDelay:0.0];
  29. return YES;
  30. }
  31. ////////////////////////////////////////////////////////////////////////////////////////////////////
  32. - (void)applicationWillResignActive:(UIApplication*)application
  33. {
  34. EBUS_EVENT(AzFramework::IosLifecycleEvents::Bus, OnWillResignActive);
  35. }
  36. ////////////////////////////////////////////////////////////////////////////////////////////////////
  37. - (void)applicationDidEnterBackground:(UIApplication*)application
  38. {
  39. EBUS_EVENT(AzFramework::IosLifecycleEvents::Bus, OnDidEnterBackground);
  40. }
  41. ////////////////////////////////////////////////////////////////////////////////////////////////////
  42. - (void)applicationWillEnterForeground:(UIApplication*)application
  43. {
  44. EBUS_EVENT(AzFramework::IosLifecycleEvents::Bus, OnWillEnterForeground);
  45. }
  46. ////////////////////////////////////////////////////////////////////////////////////////////////////
  47. - (void)applicationDidBecomeActive:(UIApplication*)application
  48. {
  49. EBUS_EVENT(AzFramework::IosLifecycleEvents::Bus, OnDidBecomeActive);
  50. }
  51. ////////////////////////////////////////////////////////////////////////////////////////////////////
  52. - (void)applicationWillTerminate:(UIApplication *)application
  53. {
  54. EBUS_EVENT(AzFramework::IosLifecycleEvents::Bus, OnWillTerminate);
  55. }
  56. ////////////////////////////////////////////////////////////////////////////////////////////////////
  57. - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
  58. {
  59. EBUS_EVENT(AzFramework::IosLifecycleEvents::Bus, OnDidReceiveMemoryWarning);
  60. }
  61. @end