cocos2d-x CC_SYNTHESIZE_READONLY
发布时间:2020-12-14 21:09:21 所属栏目:百科 来源:网络整理
导读:http://www.cnblogs.com/wanqieddy/p/3323748.html //定义一个只读属性Label,在类定义中可以使用this-getLabel来访问 CC_SYNTHESIZE_READONLY(cocos2d::CCLabelTTF*,_label,Label); CC_SYNTHESIZE_READONLY(varType,varName,funName)声明一个成员变量以及ge
http://www.cnblogs.com/wanqieddy/p/3323748.html
//定义一个只读属性Label,在类定义中可以使用this->getLabel来访问
CC_SYNTHESIZE_READONLY(cocos2d::CCLabelTTF*,_label,Label);
CC_SYNTHESIZE_READONLY(varType,varName,funName)声明一个成员变量以及getfunName函数,没有set函数。getfunName已经实现,其实现就是返回这个值。
this
->_layer = GameOverLayer::node();
this
->_layer->retain();
this
->addChild(_layer);
bool
GameOverLayer::init()
{
if
(CCLayerColor::initWithColor(ccc4(255,255,255)))
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
this
->_label = CCLabelTTF::labelWithString(
""
,
"Artial"
,32);
this
->_label->retain();
this
->_label->setColor(ccc3(0,0));
this
->_label->setPosition(ccp(winSize.width/2,winSize.height/2));
this
->addChild(
this
->_label);
this
->runAction(CCSequence::actions(CCDelayTime::actionWithDuration(3),
CCCallFunc::actionWithTarget(
this
,
callfunc_selector(GameOverLayer::gameOverDone)),NULL));
return
true
;
}
else
{
return
false
;
}
}
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |