Merge pull request #607 from dualface/fix-xcode4-template

* fix Xcode 4 template, AppController.mm not call AppDelegate:applicationDidEnterBackground() & AppDelegate:applicationWillEnterForeground()
This commit is contained in:
minggo 2011-12-05 19:46:14 -08:00
commit d97e1b705f
4 changed files with 36 additions and 36 deletions

View File

@ -21,8 +21,8 @@
// cocos2d application instance // cocos2d application instance
static AppDelegate s_sharedApplication; static AppDelegate s_sharedApplication;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch. // Override point for customization after application launch.
// Add the view controller's view to the window and display. // Add the view controller's view to the window and display.
@ -34,8 +34,8 @@ static AppDelegate s_sharedApplication;
sharegroup: nil sharegroup: nil
multiSampling: NO multiSampling: NO
numberOfSamples: 0 ]; numberOfSamples: 0 ];
// Use RootViewController manage EAGLView // Use RootViewController manage EAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES; viewController.wantsFullScreenLayout = YES;
viewController.view = __glView; viewController.view = __glView;
@ -45,7 +45,7 @@ static AppDelegate s_sharedApplication;
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::CCApplication::sharedApplication().run(); cocos2d::CCApplication::sharedApplication().run();
return YES; return YES;
} }
@ -68,17 +68,17 @@ static AppDelegate s_sharedApplication;
- (void)applicationDidEnterBackground:(UIApplication *)application { - (void)applicationDidEnterBackground:(UIApplication *)application {
/* /*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits. If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/ */
cocos2d::CCDirector::sharedDirector()->stopAnimation(); cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground();
} }
- (void)applicationWillEnterForeground:(UIApplication *)application { - (void)applicationWillEnterForeground:(UIApplication *)application {
/* /*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/ */
cocos2d::CCDirector::sharedDirector()->startAnimation(); cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground();
} }
- (void)applicationWillTerminate:(UIApplication *)application { - (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -21,8 +21,8 @@
// cocos2d application instance // cocos2d application instance
static AppDelegate s_sharedApplication; static AppDelegate s_sharedApplication;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch. // Override point for customization after application launch.
// Add the view controller's view to the window and display. // Add the view controller's view to the window and display.
@ -34,8 +34,8 @@ static AppDelegate s_sharedApplication;
sharegroup: nil sharegroup: nil
multiSampling: NO multiSampling: NO
numberOfSamples:0 ]; numberOfSamples:0 ];
// Use RootViewController manage EAGLView // Use RootViewController manage EAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES; viewController.wantsFullScreenLayout = YES;
viewController.view = __glView; viewController.view = __glView;
@ -45,7 +45,7 @@ static AppDelegate s_sharedApplication;
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::CCApplication::sharedApplication().run(); cocos2d::CCApplication::sharedApplication().run();
return YES; return YES;
} }
@ -68,17 +68,17 @@ static AppDelegate s_sharedApplication;
- (void)applicationDidEnterBackground:(UIApplication *)application { - (void)applicationDidEnterBackground:(UIApplication *)application {
/* /*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits. If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/ */
cocos2d::CCDirector::sharedDirector()->stopAnimation(); cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground();
} }
- (void)applicationWillEnterForeground:(UIApplication *)application { - (void)applicationWillEnterForeground:(UIApplication *)application {
/* /*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/ */
cocos2d::CCDirector::sharedDirector()->startAnimation(); cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground();
} }
- (void)applicationWillTerminate:(UIApplication *)application { - (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -21,8 +21,8 @@
// cocos2d application instance // cocos2d application instance
static AppDelegate s_sharedApplication; static AppDelegate s_sharedApplication;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch. // Override point for customization after application launch.
// Add the view controller's view to the window and display. // Add the view controller's view to the window and display.
@ -34,8 +34,8 @@ static AppDelegate s_sharedApplication;
sharegroup: nil sharegroup: nil
multiSampling: NO multiSampling: NO
numberOfSamples: 0 ]; numberOfSamples: 0 ];
// Use RootViewController manage EAGLView // Use RootViewController manage EAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES; viewController.wantsFullScreenLayout = YES;
viewController.view = __glView; viewController.view = __glView;
@ -45,7 +45,7 @@ static AppDelegate s_sharedApplication;
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::CCApplication::sharedApplication().run(); cocos2d::CCApplication::sharedApplication().run();
return YES; return YES;
} }
@ -68,17 +68,17 @@ static AppDelegate s_sharedApplication;
- (void)applicationDidEnterBackground:(UIApplication *)application { - (void)applicationDidEnterBackground:(UIApplication *)application {
/* /*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits. If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/ */
cocos2d::CCDirector::sharedDirector()->stopAnimation(); cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground();
} }
- (void)applicationWillEnterForeground:(UIApplication *)application { - (void)applicationWillEnterForeground:(UIApplication *)application {
/* /*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/ */
cocos2d::CCDirector::sharedDirector()->startAnimation(); cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground();
} }
- (void)applicationWillTerminate:(UIApplication *)application { - (void)applicationWillTerminate:(UIApplication *)application {

View File

@ -1,18 +1,18 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2010 cocos2d-x.org Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -37,8 +37,8 @@
// cocos2d application instance // cocos2d application instance
static AppDelegate s_sharedApplication; static AppDelegate s_sharedApplication;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch. // Override point for customization after application launch.
// Add the view controller's view to the window and display. // Add the view controller's view to the window and display.
@ -50,8 +50,8 @@ static AppDelegate s_sharedApplication;
sharegroup: nil sharegroup: nil
multiSampling: NO multiSampling: NO
numberOfSamples: 0 ]; numberOfSamples: 0 ];
// Use RootViewController manage EAGLView // Use RootViewController manage EAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES; viewController.wantsFullScreenLayout = YES;
viewController.view = __glView; viewController.view = __glView;
@ -61,7 +61,7 @@ static AppDelegate s_sharedApplication;
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::CCApplication::sharedApplication().run(); cocos2d::CCApplication::sharedApplication().run();
return YES; return YES;
} }
@ -84,17 +84,17 @@ static AppDelegate s_sharedApplication;
- (void)applicationDidEnterBackground:(UIApplication *)application { - (void)applicationDidEnterBackground:(UIApplication *)application {
/* /*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits. If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/ */
cocos2d::CCDirector::sharedDirector()->stopAnimation(); cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground();
} }
- (void)applicationWillEnterForeground:(UIApplication *)application { - (void)applicationWillEnterForeground:(UIApplication *)application {
/* /*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/ */
cocos2d::CCDirector::sharedDirector()->startAnimation(); cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground();
} }
- (void)applicationWillTerminate:(UIApplication *)application { - (void)applicationWillTerminate:(UIApplication *)application {