From 77da7b58952d14f6d7e71540cd48fa9c556ee12c Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 11 Oct 2012 16:45:14 +0800 Subject: [PATCH] issue #1486: First commit based on BorMor's branch. --- samples/HelloCpp/Classes/HelloWorldScene.cpp | 10 ++++++---- samples/HelloCpp/Classes/HelloWorldScene.h | 3 --- .../Resources/iphonehd/HelloWorld.png.REMOVED.git-id | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/samples/HelloCpp/Classes/HelloWorldScene.cpp b/samples/HelloCpp/Classes/HelloWorldScene.cpp index 28410ee365..742fbbbfd7 100644 --- a/samples/HelloCpp/Classes/HelloWorldScene.cpp +++ b/samples/HelloCpp/Classes/HelloWorldScene.cpp @@ -27,7 +27,7 @@ bool HelloWorld::init() return false; } - CCSize winSize = CCDirector::sharedDirector()->getWinSize(); + CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); ///////////////////////////// @@ -41,7 +41,8 @@ bool HelloWorld::init() this, menu_selector(HelloWorld::menuCloseCallback)); - pCloseItem->setPosition(ccp(winSize.width - 20 + origin.x, 20 + origin.y)); + pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 , + origin.y + pCloseItem->getContentSize().height/2)); // create menu, it's an autorelease object CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); @@ -56,7 +57,8 @@ bool HelloWorld::init() CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", 24); // position the label on the center of the screen - pLabel->setPosition(ccp(winSize.width/2 + origin.x, winSize.height - 50 + origin.y)); + pLabel->setPosition(ccp(origin.x + visibleSize.width/2, + origin.y + visibleSize.height - pLabel->getContentSize().height)); // add the label as a child to this layer this->addChild(pLabel, 1); @@ -65,7 +67,7 @@ bool HelloWorld::init() CCSprite* pSprite = CCSprite::create("HelloWorld.png"); // position the sprite on the center of the screen - pSprite->setPosition(ccp(winSize.width/2 + origin.x, winSize.height/2 + origin.y)); + pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); // add the sprite as a child to this layer this->addChild(pSprite, 0); diff --git a/samples/HelloCpp/Classes/HelloWorldScene.h b/samples/HelloCpp/Classes/HelloWorldScene.h index 4379df7ff0..cb4169f7cd 100644 --- a/samples/HelloCpp/Classes/HelloWorldScene.h +++ b/samples/HelloCpp/Classes/HelloWorldScene.h @@ -14,9 +14,6 @@ public: // a selector callback void menuCloseCallback(CCObject* pSender); - - // touch callback - void ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent); // implement the "static node()" method manually CREATE_FUNC(HelloWorld); diff --git a/samples/HelloCpp/Resources/iphonehd/HelloWorld.png.REMOVED.git-id b/samples/HelloCpp/Resources/iphonehd/HelloWorld.png.REMOVED.git-id index 9540c0bfb7..844d404ad6 100644 --- a/samples/HelloCpp/Resources/iphonehd/HelloWorld.png.REMOVED.git-id +++ b/samples/HelloCpp/Resources/iphonehd/HelloWorld.png.REMOVED.git-id @@ -1 +1 @@ -6b7a2544be32ce26e75737865743649598d83bdf \ No newline at end of file +7043498dfb68e43598d30ca3fa8059d460ee8672 \ No newline at end of file