SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
AppDelegate.mm
Go to the documentation of this file.
1 /**
2  * \file AppDelegate.mm
3  * \brief Implementation of the callbacks in ObjectivC for iOS
4  * \details The most eventhadlers call the C interface in SLInterface.h
5  * For more info about App framework see:
6  * https://cpvrlab.github.io/SLProject4/app-framework.html
7  * For more info on how to build for the iOS platform see:
8  * https://github.com/cpvrlab/SLProject4/wiki/Build-on-MacOS-with-XCode-for-iOS
9  * \date June 2024
10  * \authors Marino von Wattenwyl
11  * \copyright http://opensource.org/licenses/GPL-3.0
12  * \remarks Please use clangformat to format the code. See more code style on
13  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
14 */
15 
16 #import "AppDelegate.h"
17 #import "ViewController.h"
18 
19 #include <SLInterface.h>
20 
21 @implementation AppDelegate
22 
23 @synthesize window = _window;
24 @synthesize viewController = _viewController;
25 
26 - (void)dealloc
27 {
28  //[_window release];
29  //[_viewController release];
30  // [super dealloc];
31 }
32 
33 - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
34 {
35  self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
36  // Override point for customization after application launch.
37  if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
38  {
39  self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
40  }
41  else
42  {
43  self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
44  }
45  self.window.rootViewController = self.viewController;
46  [self.window makeKeyAndVisible];
47  return YES;
48 }
49 
50 - (void)applicationWillResignActive:(UIApplication*)application
51 {
52  /*
53  Sent when the application is about to move from active to inactive state.
54  This can occur for certain types of temporary interruptions (such as an
55  incoming phone call or SMS message) or when the user quits the application
56  and it begins the transition to the background state.
57  Use this method to pause ongoing tasks, disable timers, and throttle down
58  OpenGL ES frame rates. Games should use this method to pause the game.
59  */
60  printf("applicationWillResignActive\n");
61 }
62 
63 - (void)applicationDidEnterBackground:(UIApplication*)application
64 {
65  /*
66  Use this method to release shared resources, save user data, invalidate timers,
67  and store enough application state information to restore your application to
68  its current state in case it is terminated later.
69  If your application supports background execution, this method is called instead
70  of applicationWillTerminate: when the user quits.
71  */
72 
73  printf("applicationDidEnterBackground\n");
74  slTerminate();
75  exit(0);
76 }
77 
78 - (void)applicationWillEnterForeground:(UIApplication*)application
79 {
80  /*
81  Called as part of the transition from the background to the inactive state;
82  here you can undo many of the changes made on entering the background.
83  */
84 
85  printf("applicationWillEnterForeground\n");
86 }
87 
88 - (void)applicationDidBecomeActive:(UIApplication*)application
89 {
90  /*
91  Restart any tasks that were paused (or not yet started) while the application
92  was inactive. If the application was previously in the background,
93  optionally refresh the user interface.
94  */
95 
96  printf("applicationDidBecomeActive\n");
97 }
98 
99 - (void)applicationWillTerminate:(UIApplication*)application
100 {
101  /*
102  Called when the application is about to terminate.
103  Save data if appropriate.
104  See also applicationDidEnterBackground:.
105  */
106 
107  printf("applicationWillTerminate\n");
108 }
109 
110 @end
Declaration of the callbacks in ObjectivC for iOS.
static GLFWwindow * window
The global glfw window handle.
Definition: AppGLFW.cpp:35
typedef void(SL_STDCALL *cbOnImGuiBuild)(SLScene *s
Callback function typedef for ImGui build function.
void slTerminate()
Declaration of the main Scene Library C-Interface.
void dealloc()
Definition: AppDelegate.mm:26
ViewController * viewController
Definition: AppDelegate.h:23