Ryusuke Fuda's Tech Blog

Softweare Enginier about Web, iOS, Android.

cocos2dx USING_NS_CC

USING_NS_CCを記述すると
cocos2d::CCLayer のcocos2d::を省ける


BackgroundLayer.cpp

#include "BackgroundLayer.h"

USING_NS_CC; //この一行追加

bool BackgroundLayer::init()
{
    if(CCLayer::init()){
        CCSize winSize = CCDirector::sharedDirector()->getWinSize();
        CCSprite* background = CCSprite::create("Background.png");
        background->setPosition(CCPointMake(winSize.width * 0.5, winSize.height * 0.5));
        this->addChild(background);
        return true;
    }
    return false;
}