src/video/uikit/SDL_uikitappdelegate.m
changeset 3400 4ec48602f1db
parent 2859 99210400e8b9
child 3422 ec4db979dddb
equal deleted inserted replaced
3399:f96615051c8c 3400:4ec48602f1db
    54 }
    54 }
    55 
    55 
    56 @implementation SDLUIKitDelegate
    56 @implementation SDLUIKitDelegate
    57 
    57 
    58 @synthesize window;
    58 @synthesize window;
       
    59 @synthesize windowID;
    59 
    60 
    60 /* convenience method */
    61 /* convenience method */
    61 +(SDLUIKitDelegate *)sharedAppDelegate {
    62 +(SDLUIKitDelegate *)sharedAppDelegate {
    62 	/* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */
    63 	/* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */
    63 	return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
    64 	return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
    64 }
    65 }
    65 
    66 
    66 - (id)init {
    67 - (id)init {
    67 	self = [super init];
    68 	self = [super init];
    68 	window = nil;
    69 	window = nil;
       
    70 	windowID = 0;
    69 	return self;
    71 	return self;
    70 }
    72 }
    71 
    73 
    72 - (void)applicationDidFinishLaunching:(UIApplication *)application {
    74 - (void)applicationDidFinishLaunching:(UIApplication *)application {
    73 			
    75 			
    95 	 /* hack to prevent automatic termination.  See SDL_uikitevents.m for details */
    97 	 /* hack to prevent automatic termination.  See SDL_uikitevents.m for details */
    96 	longjmp(*(jump_env()), 1);
    98 	longjmp(*(jump_env()), 1);
    97 	
    99 	
    98 }
   100 }
    99 
   101 
       
   102 - (void) applicationWillResignActive:(UIApplication*)application
       
   103 {
       
   104 //	NSLog(@"%@", NSStringFromSelector(_cmd));
       
   105 	SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
       
   106 }
       
   107 
       
   108 - (void) applicationDidBecomeActive:(UIApplication*)application
       
   109 {
       
   110 //	NSLog(@"%@", NSStringFromSelector(_cmd));
       
   111 	SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_RESTORED, 0, 0);
       
   112 }
       
   113 
       
   114 
       
   115 
   100 -(void)dealloc {
   116 -(void)dealloc {
   101 	[window release];
   117 	[window release];
   102 	[super dealloc];
   118 	[super dealloc];
   103 }
   119 }
   104 
   120