mirror of https://github.com/axmolengine/axmol.git
[iphone] fixed #302 template for xcode
This commit is contained in:
parent
ad5ee3c9f6
commit
b574a47b9e
|
@ -1,86 +0,0 @@
|
|||
//
|
||||
// AppDelegate.cpp
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
#include "cocos2d.h"
|
||||
|
||||
#include "AppDelegate.h"
|
||||
#include "HelloWorldScene.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
|
||||
AppDelegate::AppDelegate()
|
||||
:m_pMainWnd(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
#if defined(CCX_PLATFORM_WIN32)
|
||||
CCX_SAFE_DELETE(m_pMainWnd);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// init the window
|
||||
#if defined(CCX_PLATFORM_UPHONE)
|
||||
if (!(m_pMainWnd = new CCXEGLView(this)) ||
|
||||
! m_pMainWnd->Create(&TRectangle(0,0,GetScreenWidth(),GetScreenHeight())))
|
||||
#elif defined(CCX_PLATFORM_WIN32)
|
||||
if (! (m_pMainWnd = new CCXEGLView()) ||
|
||||
! m_pMainWnd->Create(L"HelloWorld", 320, 480))
|
||||
#elif defined(CCX_PLATFORM_IPHONE)
|
||||
if (! (m_pMainWnd = new CCXEGLView() ) )
|
||||
#elif defined(CCX_PLATFORM_ANDROID)
|
||||
if (!(m_pMainWnd = CCDirector::sharedDirector()->getOpenGLView()))
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
{
|
||||
delete m_pMainWnd;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// init director
|
||||
CCDirector *pDirector = CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(m_pMainWnd);
|
||||
|
||||
// sets landscape mode
|
||||
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayFPS(true);
|
||||
|
||||
// create a scene. it's an autorelease object
|
||||
CCScene *pScene = HelloWorld::scene();
|
||||
|
||||
// run
|
||||
pDirector->runWithScene(pScene);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
CCDirector::sharedDirector()->pause();
|
||||
|
||||
// if you use SimpleAudioEngine, it must be pause
|
||||
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
// this function will be called when the app is active again
|
||||
void AppDelegate::applicationWillEnterForeground()
|
||||
{
|
||||
CCDirector::sharedDirector()->resume();
|
||||
|
||||
// if you use SimpleAudioEngine, it must resume here
|
||||
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
//
|
||||
// AppDelegate.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
#ifndef _APP_DELEGATE_H_
|
||||
#define _APP_DELEGATE_H_
|
||||
|
||||
#include "CCXApplication.h"
|
||||
#include "CCXEGLView.h"
|
||||
|
||||
class AppDelegate : public cocos2d::CCXApplication
|
||||
{
|
||||
public:
|
||||
AppDelegate();
|
||||
~AppDelegate();
|
||||
|
||||
virtual bool applicationDidFinishLaunching();
|
||||
virtual void applicationDidEnterBackground();
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
||||
protected:
|
||||
cocos2d::CCXEGLView * m_pMainWnd;
|
||||
};
|
||||
|
||||
|
||||
#endif // _APP_DELEGATE_H_
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppController.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
@interface ___PROJECTNAMEASIDENTIFIER___AppController : NSObject <UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppController.mm
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "___PROJECTNAMEASIDENTIFIER___AppController.h"
|
||||
#import "cocos2d.h"
|
||||
#import "EAGLView.h"
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@implementation ___PROJECTNAMEASIDENTIFIER___AppController
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Application lifecycle
|
||||
|
||||
- (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.
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: 0
|
||||
preserveBackbuffer: NO
|
||||
sharegroup:nil
|
||||
multiSampling:NO
|
||||
numberOfSamples:0];
|
||||
[__glView setMultipleTouchEnabled:YES];
|
||||
[window addSubview: __glView];
|
||||
[window makeKeyAndVisible];
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden: YES];
|
||||
|
||||
AppDelegate app;
|
||||
app.run();
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
/*
|
||||
Called when the application is about to terminate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Memory management
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
/*
|
||||
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
UIApplicationMain(argc, argv, nil, @"___PROJECTNAMEASIDENTIFIER___AppController");
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppDelegate.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "cocos2d.h"
|
||||
|
||||
@class RootViewController;
|
||||
|
||||
@interface ___PROJECTNAMEASIDENTIFIER___AppDelegate : NSObject <UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
RootViewController *viewController;
|
||||
cocos2d::CCXEGLView *view;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) UIWindow *window;
|
||||
|
||||
@end
|
|
@ -0,0 +1,98 @@
|
|||
//
|
||||
// apptestAppDelegate.m
|
||||
// apptest
|
||||
//
|
||||
// Created by Walzer on 11-1-17.
|
||||
// Copyright __MyCompanyName__ 2011. All rights reserved.
|
||||
//
|
||||
|
||||
#import "EAGLView.h"
|
||||
#import "___PROJECTNAMEASIDENTIFIER___AppDelegate.h"
|
||||
#import "HelloWorldScene.h"
|
||||
#import "platform/iphone/CCDirectorCaller.h"
|
||||
|
||||
@implementation ___PROJECTNAMEASIDENTIFIER___AppDelegate
|
||||
|
||||
@synthesize window;
|
||||
|
||||
- (void) applicationDidFinishLaunching:(UIApplication*)application
|
||||
{
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: 0
|
||||
preserveBackbuffer: NO
|
||||
sharegroup:nil
|
||||
multiSampling:NO
|
||||
numberOfSamples:0];
|
||||
[__glView setMultipleTouchEnabled:YES];
|
||||
[window addSubview: __glView];
|
||||
[window makeKeyAndVisible];
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden: YES];
|
||||
|
||||
// // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
|
||||
// if (! CCDirector::sharedDirector()->enableRetinaDisplay(true)) {
|
||||
// CCLOG("Retina Display Not supported");
|
||||
// }
|
||||
|
||||
// init director
|
||||
view = new cocos2d::CCXEGLView();
|
||||
cocos2d::CCDirector *pDirector = cocos2d::CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(view);
|
||||
|
||||
cocos2d::CCDirector::sharedDirector()->setDeviceOrientation(cocos2d::kCCDeviceOrientationLandscapeLeft);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayFPS(true);
|
||||
|
||||
// create a scene. it's an autorelease object
|
||||
cocos2d::CCScene *pScene = HelloWorld::scene();
|
||||
|
||||
// run
|
||||
pDirector->runWithScene(pScene);
|
||||
|
||||
// start mainloop
|
||||
[[CCDirectorCaller sharedDirectorCaller] startMainLoop];
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->pause();
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->resume();
|
||||
}
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->purgeCachedData();
|
||||
}
|
||||
|
||||
-(void) applicationDidEnterBackground:(UIApplication*)application {
|
||||
cocos2d::CCDirector::sharedDirector()->stopAnimation();
|
||||
}
|
||||
|
||||
-(void) applicationWillEnterForeground:(UIApplication*)application {
|
||||
cocos2d::CCDirector::sharedDirector()->startAnimation();
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->end();
|
||||
|
||||
[viewController release];
|
||||
|
||||
[window release];
|
||||
}
|
||||
|
||||
- (void)applicationSignificantTimeChange:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->setNextDeltaTimeZero(true);
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
delete view;
|
||||
[window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
0
template/ios_mac/cocos2d-x_app/___PROJECTNAMEASIDENTIFIER____Prefix.pch
Normal file → Executable file
0
template/ios_mac/cocos2d-x_app/___PROJECTNAMEASIDENTIFIER____Prefix.pch
Normal file → Executable file
0
template/ios_mac/cocos2d-x_app/___PROJECTNAME___.xcodeproj/TemplateIcon.icns
Normal file → Executable file
0
template/ios_mac/cocos2d-x_app/___PROJECTNAME___.xcodeproj/TemplateIcon.icns
Normal file → Executable file
|
@ -1 +1 @@
|
|||
31bcb75279b81b476380e0200382ab0d92d29632
|
||||
8eaad60733877a3f984c20062f8e7b3ca4dfdd5c
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// main.m
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
int retVal = UIApplicationMain(argc, argv, nil, @"___PROJECTNAMEASIDENTIFIER___AppDelegate");
|
||||
[pool release];
|
||||
return retVal;
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
//
|
||||
// AppDelegate.cpp
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#include "AppDelegate.h"
|
||||
#include "HelloWorldScene.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
|
||||
AppDelegate::AppDelegate()
|
||||
:m_pMainWnd(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
#if defined(CCX_PLATFORM_WIN32)
|
||||
CCX_SAFE_DELETE(m_pMainWnd);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// init the window
|
||||
#if defined(CCX_PLATFORM_UPHONE)
|
||||
if (!(m_pMainWnd = new CCXEGLView(this)) ||
|
||||
! m_pMainWnd->Create(&TRectangle(0,0,GetScreenWidth(),GetScreenHeight())))
|
||||
#elif defined(CCX_PLATFORM_WIN32)
|
||||
if (! (m_pMainWnd = new CCXEGLView()) ||
|
||||
! m_pMainWnd->Create(L"HelloWorld", 320, 480))
|
||||
#elif defined(CCX_PLATFORM_IPHONE)
|
||||
if (! (m_pMainWnd = new CCXEGLView() ) )
|
||||
#elif defined(CCX_PLATFORM_ANDROID)
|
||||
if (!(m_pMainWnd = CCDirector::sharedDirector()->getOpenGLView()))
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
{
|
||||
delete m_pMainWnd;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// init director
|
||||
CCDirector *pDirector = CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(m_pMainWnd);
|
||||
|
||||
// sets landscape mode
|
||||
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayFPS(true);
|
||||
|
||||
// create a scene. it's an autorelease object
|
||||
CCScene *pScene = HelloWorld::scene();
|
||||
|
||||
// run
|
||||
pDirector->runWithScene(pScene);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
CCDirector::sharedDirector()->pause();
|
||||
|
||||
// if you use SimpleAudioEngine, it must be pause
|
||||
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
// this function will be called when the app is active again
|
||||
void AppDelegate::applicationWillEnterForeground()
|
||||
{
|
||||
CCDirector::sharedDirector()->resume();
|
||||
|
||||
// if you use SimpleAudioEngine, it must resume here
|
||||
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// AppDelegate.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#ifndef _APP_DELEGATE_H_
|
||||
#define _APP_DELEGATE_H_
|
||||
|
||||
#include "CCXApplication.h"
|
||||
#include "CCXEGLView.h"
|
||||
|
||||
class AppDelegate : public cocos2d::CCXApplication
|
||||
{
|
||||
public:
|
||||
AppDelegate();
|
||||
~AppDelegate();
|
||||
|
||||
virtual bool applicationDidFinishLaunching();
|
||||
virtual void applicationDidEnterBackground();
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
||||
protected:
|
||||
cocos2d::CCXEGLView * m_pMainWnd;
|
||||
};
|
||||
|
||||
|
||||
#endif // _APP_DELEGATE_H_
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppController.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
@interface ___PROJECTNAMEASIDENTIFIER___AppController : NSObject <UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppController.mm
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "___PROJECTNAMEASIDENTIFIER___AppController.h"
|
||||
#import "cocos2d.h"
|
||||
#import "EAGLView.h"
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@implementation ___PROJECTNAMEASIDENTIFIER___AppController
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Application lifecycle
|
||||
|
||||
- (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.
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: 0
|
||||
preserveBackbuffer: NO
|
||||
sharegroup:nil
|
||||
multiSampling:NO
|
||||
numberOfSamples:0];
|
||||
[__glView setMultipleTouchEnabled:YES];
|
||||
[window addSubview: __glView];
|
||||
[window makeKeyAndVisible];
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden: YES];
|
||||
|
||||
AppDelegate app;
|
||||
app.run();
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
/*
|
||||
Called when the application is about to terminate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Memory management
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
/*
|
||||
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppDelegate.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "cocos2d.h"
|
||||
|
||||
@class RootViewController;
|
||||
|
||||
@interface ___PROJECTNAMEASIDENTIFIER___AppDelegate : NSObject <UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
RootViewController *viewController;
|
||||
cocos2d::CCXEGLView *view;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) UIWindow *window;
|
||||
|
||||
@end
|
|
@ -0,0 +1,98 @@
|
|||
//
|
||||
// apptestAppDelegate.m
|
||||
// apptest
|
||||
//
|
||||
// Created by Walzer on 11-1-17.
|
||||
// Copyright __MyCompanyName__ 2011. All rights reserved.
|
||||
//
|
||||
|
||||
#import "EAGLView.h"
|
||||
#import "___PROJECTNAMEASIDENTIFIER___AppDelegate.h"
|
||||
#import "HelloWorldScene.h"
|
||||
#import "platform/iphone/CCDirectorCaller.h"
|
||||
|
||||
@implementation ___PROJECTNAMEASIDENTIFIER___AppDelegate
|
||||
|
||||
@synthesize window;
|
||||
|
||||
- (void) applicationDidFinishLaunching:(UIApplication*)application
|
||||
{
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: 0
|
||||
preserveBackbuffer: NO
|
||||
sharegroup:nil
|
||||
multiSampling:NO
|
||||
numberOfSamples:0];
|
||||
[__glView setMultipleTouchEnabled:YES];
|
||||
[window addSubview: __glView];
|
||||
[window makeKeyAndVisible];
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden: YES];
|
||||
|
||||
// // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
|
||||
// if (! CCDirector::sharedDirector()->enableRetinaDisplay(true)) {
|
||||
// CCLOG("Retina Display Not supported");
|
||||
// }
|
||||
|
||||
// init director
|
||||
view = new cocos2d::CCXEGLView();
|
||||
cocos2d::CCDirector *pDirector = cocos2d::CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(view);
|
||||
|
||||
cocos2d::CCDirector::sharedDirector()->setDeviceOrientation(cocos2d::kCCDeviceOrientationLandscapeLeft);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayFPS(true);
|
||||
|
||||
// create a scene. it's an autorelease object
|
||||
cocos2d::CCScene *pScene = HelloWorld::scene();
|
||||
|
||||
// run
|
||||
pDirector->runWithScene(pScene);
|
||||
|
||||
// start mainloop
|
||||
[[CCDirectorCaller sharedDirectorCaller] startMainLoop];
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->pause();
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->resume();
|
||||
}
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->purgeCachedData();
|
||||
}
|
||||
|
||||
-(void) applicationDidEnterBackground:(UIApplication*)application {
|
||||
cocos2d::CCDirector::sharedDirector()->stopAnimation();
|
||||
}
|
||||
|
||||
-(void) applicationWillEnterForeground:(UIApplication*)application {
|
||||
cocos2d::CCDirector::sharedDirector()->startAnimation();
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->end();
|
||||
|
||||
[viewController release];
|
||||
|
||||
[window release];
|
||||
}
|
||||
|
||||
- (void)applicationSignificantTimeChange:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->setNextDeltaTimeZero(true);
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
delete view;
|
||||
[window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
0
template/ios_mac/cocos2d-x_box2d_app/___PROJECTNAMEASIDENTIFIER____Prefix.pch
Normal file → Executable file
0
template/ios_mac/cocos2d-x_box2d_app/___PROJECTNAMEASIDENTIFIER____Prefix.pch
Normal file → Executable file
0
template/ios_mac/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/TemplateIcon.icns
Normal file → Executable file
0
template/ios_mac/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/TemplateIcon.icns
Normal file → Executable file
|
@ -1 +1 @@
|
|||
780bee0827659474dfe7df01ccbb867aee6fbec2
|
||||
86485d992dea618d4513528e3a102cce15955c49
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
int retVal = UIApplicationMain(argc, argv, nil, @"___PROJECTNAMEASIDENTIFIER___AppController");
|
||||
int retVal = UIApplicationMain(argc, argv, nil, @"___PROJECTNAMEASIDENTIFIER___AppDelegate");
|
||||
[pool release];
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
//
|
||||
// AppDelegate.cpp
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#include "AppDelegate.h"
|
||||
#include "HelloWorldScene.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
|
||||
AppDelegate::AppDelegate()
|
||||
:m_pMainWnd(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
#if defined(CCX_PLATFORM_WIN32)
|
||||
CCX_SAFE_DELETE(m_pMainWnd);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// init the window
|
||||
#if defined(CCX_PLATFORM_UPHONE)
|
||||
if (!(m_pMainWnd = new CCXEGLView(this)) ||
|
||||
! m_pMainWnd->Create(&TRectangle(0,0,GetScreenWidth(),GetScreenHeight())))
|
||||
#elif defined(CCX_PLATFORM_WIN32)
|
||||
if (! (m_pMainWnd = new CCXEGLView()) ||
|
||||
! m_pMainWnd->Create(L"HelloWorld", 320, 480))
|
||||
#elif defined(CCX_PLATFORM_IPHONE)
|
||||
if (! (m_pMainWnd = new CCXEGLView() ) )
|
||||
#elif defined(CCX_PLATFORM_ANDROID)
|
||||
if (!(m_pMainWnd = CCDirector::sharedDirector()->getOpenGLView()))
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
{
|
||||
delete m_pMainWnd;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// init director
|
||||
CCDirector *pDirector = CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(m_pMainWnd);
|
||||
|
||||
// sets landscape mode
|
||||
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayFPS(true);
|
||||
|
||||
// create a scene. it's an autorelease object
|
||||
CCScene *pScene = HelloWorld::scene();
|
||||
|
||||
// run
|
||||
pDirector->runWithScene(pScene);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
CCDirector::sharedDirector()->pause();
|
||||
|
||||
// if you use SimpleAudioEngine, it must be pause
|
||||
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
// this function will be called when the app is active again
|
||||
void AppDelegate::applicationWillEnterForeground()
|
||||
{
|
||||
CCDirector::sharedDirector()->resume();
|
||||
|
||||
// if you use SimpleAudioEngine, it must resume here
|
||||
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// AppDelegate.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#ifndef _APP_DELEGATE_H_
|
||||
#define _APP_DELEGATE_H_
|
||||
|
||||
#include "CCXApplication.h"
|
||||
#include "CCXEGLView.h"
|
||||
|
||||
class AppDelegate : public cocos2d::CCXApplication
|
||||
{
|
||||
public:
|
||||
AppDelegate();
|
||||
~AppDelegate();
|
||||
|
||||
virtual bool applicationDidFinishLaunching();
|
||||
virtual void applicationDidEnterBackground();
|
||||
virtual void applicationWillEnterForeground();
|
||||
|
||||
protected:
|
||||
cocos2d::CCXEGLView * m_pMainWnd;
|
||||
};
|
||||
|
||||
|
||||
#endif // _APP_DELEGATE_H_
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppController.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
@interface ___PROJECTNAMEASIDENTIFIER___AppController : NSObject <UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppController.mm
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "___PROJECTNAMEASIDENTIFIER___AppController.h"
|
||||
#import "cocos2d.h"
|
||||
#import "EAGLView.h"
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@implementation ___PROJECTNAMEASIDENTIFIER___AppController
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Application lifecycle
|
||||
|
||||
- (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.
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: 0
|
||||
preserveBackbuffer: NO
|
||||
sharegroup:nil
|
||||
multiSampling:NO
|
||||
numberOfSamples:0];
|
||||
[__glView setMultipleTouchEnabled:YES];
|
||||
[window addSubview: __glView];
|
||||
[window makeKeyAndVisible];
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden: YES];
|
||||
|
||||
AppDelegate app;
|
||||
app.run();
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (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.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
/*
|
||||
Called when the application is about to terminate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Memory management
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
/*
|
||||
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// ___PROJECTNAMEASIDENTIFIER___AppDelegate.h
|
||||
// ___PROJECTNAME___
|
||||
//
|
||||
// Created by ___FULLUSERNAME___ on ___DATE___.
|
||||
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "cocos2d.h"
|
||||
|
||||
@class RootViewController;
|
||||
|
||||
@interface ___PROJECTNAMEASIDENTIFIER___AppDelegate : NSObject <UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
RootViewController *viewController;
|
||||
cocos2d::CCXEGLView *view;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) UIWindow *window;
|
||||
|
||||
@end
|
|
@ -0,0 +1,98 @@
|
|||
//
|
||||
// apptestAppDelegate.m
|
||||
// apptest
|
||||
//
|
||||
// Created by Walzer on 11-1-17.
|
||||
// Copyright __MyCompanyName__ 2011. All rights reserved.
|
||||
//
|
||||
|
||||
#import "EAGLView.h"
|
||||
#import "___PROJECTNAMEASIDENTIFIER___AppDelegate.h"
|
||||
#import "HelloWorldScene.h"
|
||||
#import "platform/iphone/CCDirectorCaller.h"
|
||||
|
||||
@implementation ___PROJECTNAMEASIDENTIFIER___AppDelegate
|
||||
|
||||
@synthesize window;
|
||||
|
||||
- (void) applicationDidFinishLaunching:(UIApplication*)application
|
||||
{
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: 0
|
||||
preserveBackbuffer: NO
|
||||
sharegroup:nil
|
||||
multiSampling:NO
|
||||
numberOfSamples:0];
|
||||
[__glView setMultipleTouchEnabled:YES];
|
||||
[window addSubview: __glView];
|
||||
[window makeKeyAndVisible];
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden: YES];
|
||||
|
||||
// // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
|
||||
// if (! CCDirector::sharedDirector()->enableRetinaDisplay(true)) {
|
||||
// CCLOG("Retina Display Not supported");
|
||||
// }
|
||||
|
||||
// init director
|
||||
view = new cocos2d::CCXEGLView();
|
||||
cocos2d::CCDirector *pDirector = cocos2d::CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(view);
|
||||
|
||||
cocos2d::CCDirector::sharedDirector()->setDeviceOrientation(cocos2d::kCCDeviceOrientationLandscapeLeft);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayFPS(true);
|
||||
|
||||
// create a scene. it's an autorelease object
|
||||
cocos2d::CCScene *pScene = HelloWorld::scene();
|
||||
|
||||
// run
|
||||
pDirector->runWithScene(pScene);
|
||||
|
||||
// start mainloop
|
||||
[[CCDirectorCaller sharedDirectorCaller] startMainLoop];
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->pause();
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->resume();
|
||||
}
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->purgeCachedData();
|
||||
}
|
||||
|
||||
-(void) applicationDidEnterBackground:(UIApplication*)application {
|
||||
cocos2d::CCDirector::sharedDirector()->stopAnimation();
|
||||
}
|
||||
|
||||
-(void) applicationWillEnterForeground:(UIApplication*)application {
|
||||
cocos2d::CCDirector::sharedDirector()->startAnimation();
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->end();
|
||||
|
||||
[viewController release];
|
||||
|
||||
[window release];
|
||||
}
|
||||
|
||||
- (void)applicationSignificantTimeChange:(UIApplication *)application {
|
||||
cocos2d::CCDirector::sharedDirector()->setNextDeltaTimeZero(true);
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
delete view;
|
||||
[window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
0
template/ios_mac/cocos2d-x_chipmunk_app/___PROJECTNAMEASIDENTIFIER____Prefix.pch
Normal file → Executable file
0
template/ios_mac/cocos2d-x_chipmunk_app/___PROJECTNAMEASIDENTIFIER____Prefix.pch
Normal file → Executable file
0
template/ios_mac/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/TemplateIcon.icns
Normal file → Executable file
0
template/ios_mac/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/TemplateIcon.icns
Normal file → Executable file
|
@ -1 +1 @@
|
|||
e4e97e44345dfc7a71318d585af4d4ea81f38fcd
|
||||
31d059bae90b466d226532d68266be129882eb4d
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
int retVal = UIApplicationMain(argc, argv, nil, @"___PROJECTNAMEASIDENTIFIER___AppController");
|
||||
int retVal = UIApplicationMain(argc, argv, nil, @"___PROJECTNAMEASIDENTIFIER___AppDelegate");
|
||||
[pool release];
|
||||
return retVal;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue