
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( @H_404_105@"" , @H_404_105@"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 ; } } 总结 以上是内存溢出为你收集整理的cocos2d-x CC_SYNTHESIZE_READONLY全部内容,希望文章能够帮你解决cocos2d-x CC_SYNTHESIZE_READONLY所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)