典型的な関数に関する覚え書き。
if ( !CCLayer::init() ) { return false; } //実際の画面に表示されている領域(width/height) CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); //基本的に0,0(x/y) CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); CCSprite* pBackground = CCSprite::create("Background.png"); pBackground->setPosition(ccp(origin.x + visibleSize.width/2, origin.y + visibleSize.height/2)); CCLog("origin.x:%f / orgin.y:%f",origin.x, origin.y); CCLog("visibleSize.width:%f / visibleSize.height:%f",visibleSize.width, visibleSize.height); CCLog("background.width:%f / background.height:%f",pBackground->getContentSize().width, pBackground->getContentSize().height); this->addChild(pBackground, 0);
実際試すと、座標設定が理解できるようになる。