Merge pull request #1055 from minggo/iss1343_xcode

fixed #1343: make xcode template work ok
This commit is contained in:
minggo 2012-06-21 21:01:24 -07:00
commit 13f066f942
9 changed files with 30 additions and 30 deletions

View File

@ -49,7 +49,7 @@ bool AppDelegate::applicationDidFinishLaunching()
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too // This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() void AppDelegate::applicationDidEnterBackground()
{ {
CCDirector::sharedDirector()->pause(); CCDirector::sharedDirector()->stopAnimation();
// if you use SimpleAudioEngine, it must be pause // if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
@ -58,7 +58,7 @@ void AppDelegate::applicationDidEnterBackground()
// this function will be called when the app is active again // this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() void AppDelegate::applicationWillEnterForeground()
{ {
CCDirector::sharedDirector()->resume(); CCDirector::sharedDirector()->startAnimation();
// if you use SimpleAudioEngine, it must resume here // if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();

View File

@ -44,7 +44,7 @@ CCAffineTransform PhysicsSprite::nodeToParentTransform(void)
float x = pos.x * PTM_RATIO; float x = pos.x * PTM_RATIO;
float y = pos.y * PTM_RATIO; float y = pos.y * PTM_RATIO;
if ( getIgnoreAnchorPointForPosition() ) { if ( isIgnoreAnchorPointForPosition() ) {
x += m_tAnchorPointInPoints.x; x += m_tAnchorPointInPoints.x;
y += m_tAnchorPointInPoints.y; y += m_tAnchorPointInPoints.y;
} }
@ -69,14 +69,14 @@ CCAffineTransform PhysicsSprite::nodeToParentTransform(void)
HelloWorld::HelloWorld() HelloWorld::HelloWorld()
{ {
setIsTouchEnabled( true ); setTouchEnabled( true );
setIsAccelerometerEnabled( true ); setAccelerometerEnabled( true );
CCSize s = CCDirector::sharedDirector()->getWinSize(); CCSize s = CCDirector::sharedDirector()->getWinSize();
// init physics // init physics
this->initPhysics(); this->initPhysics();
CCSpriteBatchNode *parent = CCSpriteBatchNode::batchNodeWithFile("blocks.png", 100); CCSpriteBatchNode *parent = CCSpriteBatchNode::create("blocks.png", 100);
m_pSpriteTexture = parent->getTexture(); m_pSpriteTexture = parent->getTexture();
addChild(parent, 0, kTagParentNode); addChild(parent, 0, kTagParentNode);
@ -84,7 +84,7 @@ HelloWorld::HelloWorld()
addNewSpriteAtPosition(ccp(s.width/2, s.height/2)); addNewSpriteAtPosition(ccp(s.width/2, s.height/2));
CCLabelTTF *label = CCLabelTTF::labelWithString("Tap screen", "Marker Felt", 32); CCLabelTTF *label = CCLabelTTF::create("Tap screen", "Marker Felt", 32);
addChild(label, 0); addChild(label, 0);
label->setColor(ccc3(0,0,255)); label->setColor(ccc3(0,0,255));
label->setPosition(ccp( s.width/2, s.height-50)); label->setPosition(ccp( s.width/2, s.height-50));
@ -214,7 +214,7 @@ void HelloWorld::addNewSpriteAtPosition(CCPoint p)
} }
void HelloWorld::update(ccTime dt) void HelloWorld::update(float dt)
{ {
//It is recommended that a fixed time step is used with Box2D for stability //It is recommended that a fixed time step is used with Box2D for stability
//of the simulation, however, we are using a variable time step here. //of the simulation, however, we are using a variable time step here.
@ -264,7 +264,7 @@ void HelloWorld::ccTouchesEnded(CCSet* touches, CCEvent* event)
CCScene* HelloWorld::scene() CCScene* HelloWorld::scene()
{ {
// 'scene' is an autorelease object // 'scene' is an autorelease object
CCScene *scene = CCScene::node(); CCScene *scene = CCScene::create();
// add layer as a child to scene // add layer as a child to scene
CCLayer* layer = new HelloWorld(); CCLayer* layer = new HelloWorld();

View File

@ -37,7 +37,7 @@ public:
virtual void draw(); virtual void draw();
virtual void ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event); virtual void ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event);
void update(cocos2d::ccTime dt); void update(float dt);
private: private:
b2World* world; b2World* world;

View File

@ -49,7 +49,7 @@ bool AppDelegate::applicationDidFinishLaunching()
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too // This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() void AppDelegate::applicationDidEnterBackground()
{ {
CCDirector::sharedDirector()->pause(); CCDirector::sharedDirector()->stopAnimation();
// if you use SimpleAudioEngine, it must be pause // if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
@ -58,7 +58,7 @@ void AppDelegate::applicationDidEnterBackground()
// this function will be called when the app is active again // this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() void AppDelegate::applicationWillEnterForeground()
{ {
CCDirector::sharedDirector()->resume(); CCDirector::sharedDirector()->startAnimation();
// if you use SimpleAudioEngine, it must resume here // if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();

View File

@ -53,7 +53,7 @@ CCAffineTransform ChipmunkPhysicsSprite::nodeToParentTransform(void)
CCFloat x = m_pBody->p.x; CCFloat x = m_pBody->p.x;
CCFloat y = m_pBody->p.y; CCFloat y = m_pBody->p.y;
if ( getIgnoreAnchorPointForPosition() ) { if ( isIgnoreAnchorPointForPosition() ) {
x += m_tAnchorPointInPoints.x; x += m_tAnchorPointInPoints.x;
y += m_tAnchorPointInPoints.y; y += m_tAnchorPointInPoints.y;
} }
@ -93,10 +93,10 @@ HelloWorld::~HelloWorld()
CCScene* HelloWorld::scene() CCScene* HelloWorld::scene()
{ {
// 'scene' is an autorelease object. // 'scene' is an autorelease object.
CCScene *scene = CCScene::node(); CCScene *scene = CCScene::create();
// 'layer' is an autorelease object. // 'layer' is an autorelease object.
HelloWorld *layer = HelloWorld::node(); HelloWorld *layer = HelloWorld::create();
// add layer as a child to scene // add layer as a child to scene
scene->addChild(layer); scene->addChild(layer);
@ -113,13 +113,13 @@ bool HelloWorld::init()
} }
// enable events // enable events
setIsTouchEnabled(true); setTouchEnabled(true);
setIsAccelerometerEnabled(true); setAccelerometerEnabled(true);
CCSize s = CCDirector::sharedDirector()->getWinSize(); CCSize s = CCDirector::sharedDirector()->getWinSize();
// title // title
CCLabelTTF *label = CCLabelTTF::labelWithString("Multi touch the screen", "Marker Felt", 36); CCLabelTTF *label = CCLabelTTF::create("Multi touch the screen", "Marker Felt", 36);
label->setPosition(ccp( s.width / 2, s.height - 30)); label->setPosition(ccp( s.width / 2, s.height - 30));
this->addChild(label, -1); this->addChild(label, -1);
@ -128,7 +128,7 @@ bool HelloWorld::init()
#if 1 #if 1
// Use batch node. Faster // Use batch node. Faster
CCSpriteBatchNode *parent = CCSpriteBatchNode::batchNodeWithFile("grossini_dance_atlas.png", 100); CCSpriteBatchNode *parent = CCSpriteBatchNode::create("grossini_dance_atlas.png", 100);
m_pSpriteTexture = parent->getTexture(); m_pSpriteTexture = parent->getTexture();
#else #else
// doesn't use batch node. Slower // doesn't use batch node. Slower
@ -179,7 +179,7 @@ void HelloWorld::initPhysics()
} }
} }
void HelloWorld::update(ccTime delta) void HelloWorld::update(float delta)
{ {
// Should use a fixed size step based on the animation interval. // Should use a fixed size step based on the animation interval.
int steps = 2; int steps = 2;

View File

@ -33,11 +33,11 @@ public:
~HelloWorld(); ~HelloWorld();
bool init(); bool init();
static cocos2d::CCScene* scene(); static cocos2d::CCScene* scene();
LAYER_NODE_FUNC(HelloWorld); LAYER_CREATE_FUNC(HelloWorld);
void initPhysics(); void initPhysics();
void addNewSpriteAtPosition(cocos2d::CCPoint p); void addNewSpriteAtPosition(cocos2d::CCPoint p);
void update(cocos2d::ccTime dt); void update(float dt);
virtual void ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event); virtual void ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event);
virtual void didAccelerate(cocos2d::CCAcceleration* pAccelerationValue); virtual void didAccelerate(cocos2d::CCAcceleration* pAccelerationValue);

View File

@ -58,7 +58,7 @@ bool AppDelegate::applicationDidFinishLaunching()
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too // This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() void AppDelegate::applicationDidEnterBackground()
{ {
CCDirector::sharedDirector()->pause(); CCDirector::sharedDirector()->stopAnimation();
// if you use SimpleAudioEngine, it must be pause // if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
@ -67,7 +67,7 @@ void AppDelegate::applicationDidEnterBackground()
// this function will be called when the app is active again // this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() void AppDelegate::applicationWillEnterForeground()
{ {
CCDirector::sharedDirector()->resume(); CCDirector::sharedDirector()->startAnimation();
// if you use SimpleAudioEngine, it must resume here // if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();

View File

@ -1 +1 @@
44156c1d13cbc3821278cc9d51e878adfd5ea603 587375a44e095a8d79480f96b3ee1588061edc3c

View File

@ -2,23 +2,23 @@ pushd ../../
echo "generating libcocos2dx" echo "generating libcocos2dx"
mkdir -p template/xcode4/lib_cocos2dx.xctemplate mkdir -p template/xcode4/lib_cocos2dx.xctemplate
python ./tools/xcode4_template_generator/template_generator.py --directory cocos2dx --identifier libcocos2dx --prefix libs --exclude "android win32 airplay wophone bada third_party CCImage.cpp CCThread.cpp proj.ios CCFileUtilsCommon_cpp.h CCImageCommon_cpp.h CCFileUtils.cpp Android.mk Linux linux qnx marmalade CCBReader_v1.cpp" > ./template/xcode4/lib_cocos2dx.xctemplate/TemplateInfo.plist python ./tools/xcode4_template_generator/template_generator.py --directory cocos2dx --identifier libcocos2dx --prefix libs --exclude "android win32 third_party CCImage.cpp CCThread.cpp proj.ios CCFileUtilsCommon_cpp.h CCImageCommon_cpp.h CCFileUtils.cpp Android.mk" > ./template/xcode4/lib_cocos2dx.xctemplate/TemplateInfo.plist
echo "generating libcocosdenshion" echo "generating libcocosdenshion"
mkdir -p template/xcode4/lib_cocosdenshion.xctemplate mkdir -p template/xcode4/lib_cocosdenshion.xctemplate
python ./tools/xcode4_template_generator/template_generator.py --directory CocosDenshion --identifier libcocosdenshion --prefix libs --exclude "android win32 airplay wophone bada third_party Android.mk Linux linux qnx marmalade" > ./template/xcode4/lib_cocosdenshion.xctemplate/TemplateInfo.plist python ./tools/xcode4_template_generator/template_generator.py --directory CocosDenshion --identifier libcocosdenshion --prefix libs --exclude "android win32 third_party Android.mk" > ./template/xcode4/lib_cocosdenshion.xctemplate/TemplateInfo.plist
echo "generating libbox2d" echo "generating libbox2d"
mkdir -p template/xcode4/lib_box2d.xctemplate mkdir -p template/xcode4/lib_box2d.xctemplate
python ./tools/xcode4_template_generator/template_generator.py --directory Box2D --identifier libbox2d --prefix libs --exclude "android win32 airplay wophone bada Android.mk Linux linux qnx marmalade" > ./template/xcode4/lib_box2d.xctemplate/TemplateInfo.plist python ./tools/xcode4_template_generator/template_generator.py --directory Box2D --identifier libbox2d --prefix libs --exclude "android win32 Android.mk" > ./template/xcode4/lib_box2d.xctemplate/TemplateInfo.plist
echo "generating libchipmunk" echo "generating libchipmunk"
mkdir -p template/xcode4/lib_chipmunk.xctemplate mkdir -p template/xcode4/lib_chipmunk.xctemplate
python ./tools/xcode4_template_generator/template_generator.py --directory chipmunk --identifier libchipmunk --prefix libs --exclude "android win32 airplay wophone bada Android.mk Linux linux CMakeFiles Makefile qnx marmalade" > ./template/xcode4/lib_chipmunk.xctemplate/TemplateInfo.plist python ./tools/xcode4_template_generator/template_generator.py --directory chipmunk --identifier libchipmunk --prefix libs --exclude "android win32 Android.mk CMakeFiles Makefile" > ./template/xcode4/lib_chipmunk.xctemplate/TemplateInfo.plist
echo "generating liblua" echo "generating liblua"
mkdir -p template/xcode4/lib_lua.xctemplate mkdir -p template/xcode4/lib_lua.xctemplate
python ./tools/xcode4_template_generator/template_generator.py --directory lua --identifier liblua --prefix libs --append ./tools/xcode4_template_generator/template_lua_patch.txt --exclude "android win32 airplay wophone bada Makefile Linux linux CMakeFiles qnx marmalade" > ./template/xcode4/lib_lua.xctemplate/TemplateInfo.plist python ./tools/xcode4_template_generator/template_generator.py --directory lua --identifier liblua --prefix libs --append ./tools/xcode4_template_generator/template_lua_patch.txt --exclude "android win32 Makefile CMakeFiles" > ./template/xcode4/lib_lua.xctemplate/TemplateInfo.plist
echo "done" echo "done"