issue #540, add RootViewController into xcode3 templates; rename _XXX_Prefix.pch to Prefix.pch; remove MIT license in user code.

This commit is contained in:
Walzer 2011-08-10 14:45:13 +08:00
parent 46808db7fd
commit 547905465b
24 changed files with 319 additions and 111 deletions

View File

@ -1 +1 @@
8a8e4250f3cfe00ec9909ad8b1cedfcccb4acf64 3aab8d3693dcaba52bbe6cf1d88bd085701c71bb

View File

@ -1,13 +1,16 @@
// //
// ___PROJECTNAMEASIDENTIFIER___AppController.h // AppController.h
// ___PROJECTNAME___ // ___PROJECTNAME___
// //
// Created by ___FULLUSERNAME___ on ___DATE___. // Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
// //
@class RootViewController;
@interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate> { @interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate> {
UIWindow *window; UIWindow *window;
RootViewController *viewController;
} }
@end @end

View File

@ -1,16 +1,19 @@
// //
// ___PROJECTNAMEASIDENTIFIER___AppController.mm // AppController.mm
// ___PROJECTNAME___ // ___PROJECTNAME___
// //
// Created by ___FULLUSERNAME___ on ___DATE___. // Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "AppController.h" #import "AppController.h"
#import "cocos2d.h" #import "cocos2d.h"
#import "EAGLView.h" #import "EAGLView.h"
#import "AppDelegate.h" #import "AppDelegate.h"
#import "RootViewController.h"
@implementation AppController @implementation AppController
#pragma mark - #pragma mark -
@ -32,7 +35,14 @@ static AppDelegate s_sharedApplication;
sharegroup: nil sharegroup: nil
multiSampling: NO multiSampling: NO
numberOfSamples: 0 ]; numberOfSamples: 0 ];
[window addSubview: __glView];
// Use RootViewController manage EAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
viewController.view = __glView;
// Set RootViewController to window
window.rootViewController = viewController;
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];
@ -41,6 +51,7 @@ static AppDelegate s_sharedApplication;
return YES; return YES;
} }
- (void)applicationWillResignActive:(UIApplication *)application { - (void)applicationWillResignActive:(UIApplication *)application {
/* /*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
@ -95,3 +106,4 @@ static AppDelegate s_sharedApplication;
@end @end

View File

@ -0,0 +1,16 @@
//
// RootViewController.h
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController {
}
@end

View File

@ -0,0 +1,61 @@
//
// RootViewController.mm
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import "RootViewController.h"
@implementation RootViewController
/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end

View File

@ -1 +1 @@
66024535e3177e78e142dc5f54f603198c2c7550 d018a539198cdce661d24e7f45fbce6fe66ff1a1

View File

@ -1,13 +1,16 @@
// //
// ___PROJECTNAMEASIDENTIFIER___AppController.h // AppController.h
// ___PROJECTNAME___ // ___PROJECTNAME___
// //
// Created by ___FULLUSERNAME___ on ___DATE___. // Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
// //
@class RootViewController;
@interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate> { @interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate> {
UIWindow *window; UIWindow *window;
RootViewController *viewController;
} }
@end @end

View File

@ -1,16 +1,19 @@
// //
// ___PROJECTNAMEASIDENTIFIER___AppController.mm // AppController.mm
// ___PROJECTNAME___ // ___PROJECTNAME___
// //
// Created by ___FULLUSERNAME___ on ___DATE___. // Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "AppController.h" #import "AppController.h"
#import "cocos2d.h" #import "cocos2d.h"
#import "EAGLView.h" #import "EAGLView.h"
#import "AppDelegate.h" #import "AppDelegate.h"
#import "RootViewController.h"
@implementation AppController @implementation AppController
#pragma mark - #pragma mark -
@ -28,11 +31,18 @@ static AppDelegate s_sharedApplication;
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds] EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
pixelFormat: kEAGLColorFormatRGBA8 pixelFormat: kEAGLColorFormatRGBA8
depthFormat: GL_DEPTH_COMPONENT16_OES depthFormat: GL_DEPTH_COMPONENT16_OES
preserveBackbuffer: NO preserveBackbuffer: NO
sharegroup: nil sharegroup: nil
multiSampling: NO multiSampling: NO
numberOfSamples:0 ]; numberOfSamples: 0 ];
[window addSubview: __glView];
// Use RootViewController manage EAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
viewController.view = __glView;
// Set RootViewController to window
window.rootViewController = viewController;
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];
@ -96,3 +106,4 @@ static AppDelegate s_sharedApplication;
@end @end

View File

@ -0,0 +1,16 @@
//
// RootViewController.h
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController {
}
@end

View File

@ -0,0 +1,61 @@
//
// RootViewController.mm
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import "RootViewController.h"
@implementation RootViewController
/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end

View File

@ -1 +1 @@
a6ca12b0bdd905d2b0dd4cad0ca30ea437326572 b59f29f9bd284c46876e7ecc47b74bfaf8a00aa6

View File

@ -1,13 +1,16 @@
// //
// ___PROJECTNAMEASIDENTIFIER___AppController.h // AppController.h
// ___PROJECTNAME___ // ___PROJECTNAME___
// //
// Created by ___FULLUSERNAME___ on ___DATE___. // Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
// //
@class RootViewController;
@interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate> { @interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate> {
UIWindow *window; UIWindow *window;
RootViewController *viewController;
} }
@end @end

View File

@ -1,16 +1,19 @@
// //
// ___PROJECTNAMEASIDENTIFIER___AppController.mm // AppController.mm
// ___PROJECTNAME___ // ___PROJECTNAME___
// //
// Created by ___FULLUSERNAME___ on ___DATE___. // Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "AppController.h" #import "AppController.h"
#import "cocos2d.h" #import "cocos2d.h"
#import "EAGLView.h" #import "EAGLView.h"
#import "AppDelegate.h" #import "AppDelegate.h"
#import "RootViewController.h"
@implementation AppController @implementation AppController
#pragma mark - #pragma mark -
@ -32,7 +35,14 @@ static AppDelegate s_sharedApplication;
sharegroup: nil sharegroup: nil
multiSampling: NO multiSampling: NO
numberOfSamples: 0 ]; numberOfSamples: 0 ];
[window addSubview: __glView];
// Use RootViewController manage EAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
viewController.view = __glView;
// Set RootViewController to window
window.rootViewController = viewController;
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];
@ -72,7 +82,6 @@ static AppDelegate s_sharedApplication;
cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground();
} }
- (void)applicationWillTerminate:(UIApplication *)application { - (void)applicationWillTerminate:(UIApplication *)application {
/* /*
Called when the application is about to terminate. Called when the application is about to terminate.
@ -97,3 +106,4 @@ static AppDelegate s_sharedApplication;
@end @end

View File

@ -0,0 +1,16 @@
//
// RootViewController.h
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController {
}
@end

View File

@ -0,0 +1,61 @@
//
// RootViewController.mm
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import "RootViewController.h"
@implementation RootViewController
/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end

View File

@ -1 +1 @@
4f2f642918e859dde3db5a24ebb9484634f1d2fc 8feced937b259baf35f5ea1d21cf2adad5d02f7d

View File

@ -1,26 +1,10 @@
/**************************************************************************** //
Copyright (c) 2010 cocos2d-x.org // AppController.h
// ___PROJECTNAME___
http://www.cocos2d-x.org //
// Created by ___FULLUSERNAME___ on ___DATE___.
Permission is hereby granted, free of charge, to any person obtaining a copy // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
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
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
@class RootViewController; @class RootViewController;

View File

@ -1,26 +1,11 @@
/**************************************************************************** //
Copyright (c) 2010 cocos2d-x.org // AppController.mm
// ___PROJECTNAME___
http://www.cocos2d-x.org //
// Created by ___FULLUSERNAME___ on ___DATE___.
Permission is hereby granted, free of charge, to any person obtaining a copy // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
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
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "AppController.h" #import "AppController.h"
#import "cocos2d.h" #import "cocos2d.h"

View File

@ -1,27 +1,10 @@
/**************************************************************************** //
Copyright (c) 2010-2011 cocos2d-x.org // RootViewController.h
Copyright (c) 2010 Ricardo Quesada // ___PROJECTNAME___
//
http://www.cocos2d-x.org // Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
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
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>

View File

@ -1,27 +1,10 @@
/**************************************************************************** //
Copyright (c) 2010-2011 cocos2d-x.org // RootViewController.mm
Copyright (c) 2010 Ricardo Quesada // ___PROJECTNAME___
//
http://www.cocos2d-x.org // Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
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
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import "RootViewController.h" #import "RootViewController.h"