issue #1486: First commit based on BorMor's branch.

This commit is contained in:
James Chen 2012-10-11 16:45:14 +08:00
parent ade54a3de7
commit 77da7b5895
3 changed files with 7 additions and 8 deletions

View File

@ -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);

View File

@ -15,9 +15,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);
};

View File

@ -1 +1 @@
6b7a2544be32ce26e75737865743649598d83bdf
7043498dfb68e43598d30ca3fa8059d460ee8672