Cocos2d-x3.3Final(9)RichText常用成员函数(C++)

前端之家收集整理的这篇文章主要介绍了Cocos2d-x3.3Final(9)RichText常用成员函数(C++)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

RichText * _richText = RichText::create();

RichElementText * re1 = RichElementText::create(1,Color3B::RED,255,str1,"Marker Felt",10);

RichElementText * re4 = RIchElementText::create(4,Color3B::GREEN,"And green with TTF support. ","fonts/Marker Felt.ttf",10);

RichElementImage * reimg = RichElementImage::create(6,Color3B::WHITE,"sliderballnormal.png");


cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("100/100.ExportJson");

cocostudio::Armature * pAr = cocostudio::Armature::create("100");

pAr->getAnimation()->play("Animation1"); //创建骨骼动画


RichElementCustomNode * recustom = RichElementCustomNode::create(1,Color::WHITE,pAr); //构造富文本元素


_richText->pushBackElement(re1);

_richText->insertElement(re2,1);

_richText->insertElement(reimg,2);

_richText->pushBackElement(recustom);


_richText->setLocalZOrder(10);

addChild(_richText);


_richText->ignoreContentAdaptWithSize(true); //是否忽略当前内容适应大小,为true则 不管_richText的大小,按照默认的渲染器的大小进行渲染。

猜你在找的Cocos2d-x相关文章