From 443656f88c051b543ee43675f4559925088d50f9 Mon Sep 17 00:00:00 2001 From: YuLei Liao Date: Tue, 6 Dec 2011 10:51:12 +0800 Subject: [PATCH] * fix Xcode 4 template, AppController.mm not call AppDelegate:applicationDidEnterBackground() & AppDelegate:applicationWillEnterForeground() --- .../cocos2dx.xctemplate/ios/AppController.mm | 16 ++++++------- .../ios/AppController.mm | 16 ++++++------- .../ios/AppController.mm | 16 ++++++------- .../ios/AppController.mm | 24 +++++++++---------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/template/xcode4/cocos2dx.xctemplate/ios/AppController.mm b/template/xcode4/cocos2dx.xctemplate/ios/AppController.mm index 7b88b642f6..d9f0df09e7 100644 --- a/template/xcode4/cocos2dx.xctemplate/ios/AppController.mm +++ b/template/xcode4/cocos2dx.xctemplate/ios/AppController.mm @@ -21,8 +21,8 @@ // cocos2d application instance 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. // Add the view controller's view to the window and display. @@ -34,8 +34,8 @@ static AppDelegate s_sharedApplication; sharegroup: nil multiSampling: NO numberOfSamples: 0 ]; - - // Use RootViewController manage EAGLView + + // Use RootViewController manage EAGLView viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController.wantsFullScreenLayout = YES; viewController.view = __glView; @@ -45,7 +45,7 @@ static AppDelegate s_sharedApplication; [window makeKeyAndVisible]; [[UIApplication sharedApplication] setStatusBarHidden: YES]; - + cocos2d::CCApplication::sharedApplication().run(); return YES; } @@ -68,17 +68,17 @@ static AppDelegate s_sharedApplication; - (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. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (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. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/template/xcode4/cocos2dx_box2d.xctemplate/ios/AppController.mm b/template/xcode4/cocos2dx_box2d.xctemplate/ios/AppController.mm index ec395eb14c..a70eba93f0 100644 --- a/template/xcode4/cocos2dx_box2d.xctemplate/ios/AppController.mm +++ b/template/xcode4/cocos2dx_box2d.xctemplate/ios/AppController.mm @@ -21,8 +21,8 @@ // cocos2d application instance 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. // Add the view controller's view to the window and display. @@ -34,8 +34,8 @@ static AppDelegate s_sharedApplication; sharegroup: nil multiSampling: NO numberOfSamples:0 ]; - - // Use RootViewController manage EAGLView + + // Use RootViewController manage EAGLView viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController.wantsFullScreenLayout = YES; viewController.view = __glView; @@ -45,7 +45,7 @@ static AppDelegate s_sharedApplication; [window makeKeyAndVisible]; [[UIApplication sharedApplication] setStatusBarHidden: YES]; - + cocos2d::CCApplication::sharedApplication().run(); return YES; } @@ -68,17 +68,17 @@ static AppDelegate s_sharedApplication; - (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. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (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. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/template/xcode4/cocos2dx_chipmunk.xctemplate/ios/AppController.mm b/template/xcode4/cocos2dx_chipmunk.xctemplate/ios/AppController.mm index b888f4d60a..c6373614a5 100644 --- a/template/xcode4/cocos2dx_chipmunk.xctemplate/ios/AppController.mm +++ b/template/xcode4/cocos2dx_chipmunk.xctemplate/ios/AppController.mm @@ -21,8 +21,8 @@ // cocos2d application instance 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. // Add the view controller's view to the window and display. @@ -34,8 +34,8 @@ static AppDelegate s_sharedApplication; sharegroup: nil multiSampling: NO numberOfSamples: 0 ]; - - // Use RootViewController manage EAGLView + + // Use RootViewController manage EAGLView viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController.wantsFullScreenLayout = YES; viewController.view = __glView; @@ -45,7 +45,7 @@ static AppDelegate s_sharedApplication; [window makeKeyAndVisible]; [[UIApplication sharedApplication] setStatusBarHidden: YES]; - + cocos2d::CCApplication::sharedApplication().run(); return YES; } @@ -68,17 +68,17 @@ static AppDelegate s_sharedApplication; - (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. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (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. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/template/xcode4/cocos2dx_lua.xctemplate/ios/AppController.mm b/template/xcode4/cocos2dx_lua.xctemplate/ios/AppController.mm index 4a436964d9..b53a436a44 100644 --- a/template/xcode4/cocos2dx_lua.xctemplate/ios/AppController.mm +++ b/template/xcode4/cocos2dx_lua.xctemplate/ios/AppController.mm @@ -1,18 +1,18 @@ /**************************************************************************** Copyright (c) 2010 cocos2d-x.org - + http://www.cocos2d-x.org - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -37,8 +37,8 @@ // cocos2d application instance 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. // Add the view controller's view to the window and display. @@ -50,8 +50,8 @@ static AppDelegate s_sharedApplication; sharegroup: nil multiSampling: NO numberOfSamples: 0 ]; - - // Use RootViewController manage EAGLView + + // Use RootViewController manage EAGLView viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController.wantsFullScreenLayout = YES; viewController.view = __glView; @@ -61,7 +61,7 @@ static AppDelegate s_sharedApplication; [window makeKeyAndVisible]; [[UIApplication sharedApplication] setStatusBarHidden: YES]; - + cocos2d::CCApplication::sharedApplication().run(); return YES; } @@ -84,17 +84,17 @@ static AppDelegate s_sharedApplication; - (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. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (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. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application {