cocos2d-x 标签加载图像,如 Sticker-Smile..(通过 html 或 ...)

cocos2d-x Label Load Image like Sticker-Smile..(by html or ...)

我正在使用 cocos2d-x (c++)... 我可以在我的标签(由图像混合的文本)中加载贴纸(微笑)吗? 我知道我们可以通过以下方式加载位图字体:

Label::createWithBMFont 

我也知道许多框架,如 flash 可以通过包含 img 标签的文本框加载 html 文本... 但是在 cocos2d-x 中的标签文本中添加微笑图像的最佳方法是什么? 可以 cocos2d 标签加载 html 文本,例如:

"hello<br>How Are You<img src="..." width=".." height=".." alt="..">"???

谢谢...

我找到了我的路... 我们可以加载图像并通过 UIRichText 显示不同的文本格式... 您也可以推送 unicode 文本... 示例代码是:

auto text = cocos2d::ui::RichText::create();
const auto font = std::string("fonts/FinalFonts/Berlin.ttf");
text->pushBackElement(ui::RichElementCustomNode::create(1995, Color3B(255, 255, 255), 255, Label::createWithSystemFont(persianText01, font, 20, Size::ZERO, TextHAlignment::RIGHT, TextVAlignment::TOP)));
text->pushBackElement(ui::RichElementImage::create(1993, Color3B(255, 255, 255), 255, "icons/sticker.png"));
text->pushBackElement(ui::RichElementCustomNode::create(1994, Color3B(255, 255, 255), 255, Label::createWithSystemFont(persianText02, font, 20, Size::ZERO, TextHAlignment::RIGHT, TextVAlignment::TOP)));
text->pushBackElement(ui::RichElementImage::create(1990, Color3B(255, 255, 255), 255, "icons3/sticker.png"));
text->pushBackElement(ui::RichElementCustomNode::create(1998, Color3B(255, 255, 255), 255, Label::createWithSystemFont(persianText03, font, 20, Size::ZERO, TextHAlignment::RIGHT, TextVAlignment::TOP)));
sprite->addChild(text);