加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

RichText

发布时间:2020-12-14 17:14:04 所属栏目:百科 来源:网络整理
导读:说明 引擎版本:cocos2d-x 3.4 编译器:visual studio 2013 UI编辑器:Cocos Studio v1.6.0.0 RichText(继承于Widget; cocos/ui模块下) 富文本,实质上是指将多种不同类型的 单元 合并到一起作为一条文本来显示。 RichText可插入一下单元: RichElementTex

说明

引擎版本:cocos2d-x 3.4 编译器:visual studio 2013 UI编辑器:Cocos Studio v1.6.0.0

RichText(继承于Widget; cocos/ui模块下)

富文本,实质上是指将多种不同类型的 单元合并到一起作为一条文本来显示。
RichText可插入一下单元:
  • RichElementText(文本)
   
   
//创建文本单元static RichElementText* create(int tag, const Color3B& color GLubyte opacity std::string text fontName float fontSize);

  • RichElementImage(图片)
RichElementImage filePath
  • RichElementCustomNode(Node)
RichElementCustomNode Node customNode 常用API:
  • //简单的添加删除操作void insertElement(RichElement element int index); pushBackElement removeElement);

  • 实例

  • //这里测试富文本控件 ui::RichText _richText =create(); _richText->ignoreContentAdaptWithSize(false);setSize(CCSizeMake(500 300));::RichElementText re1 1WHITE255 "this is white text""Helvetica"24 re2 2YELLOW"yello" re3 3BLUE"blue"47 re4 4GREEN"green is here" re5 5RED"red"::RichElementImage reimg 6"CloseNormal.png"pushBackElement(re1insertElementre2re3re4re5reimg);
  • (编辑:李大同)

    【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

      推荐文章
        热点阅读