Cocos2d-x 3.0 Rich Text

Source: Internet
Author: User
... If (this. _ super () {// init text this. _ topdisplaylabel. setstring (""); this. _ bottomdisplaylabel. setstring ("richtext"); var widgetsize = This. _ widget. getcontentsize (); // richtext // container var richtext = new ccui. richtext (); richtext. ignorecontentadaptwithsize (false); richtext. setcontentsize (CC. size (120,100); // create a string of different colors var RE1 = new ccui. richelementtext (1, CC. color. white, 255, "This color is white. "," Helvetica ", 10); var re2 = new ccui. richelementtext (2, CC. color. yellow, 255, "and this is yellow. "," Helvetica ", 10); var RE3 = new ccui. richelementtext (3, CC. color. blue, 255, "This one is blue. "," Helvetica ", 10); var RE4 = new ccui. richelementtext (4, CC. color. green, 255, "and green. "," Helvetica ", 10); var re5 = new ccui. richelementtext (5, CC. color. red, 255, "Last One is red", "Helveti CA ", 10); // supports image var reimg = new ccui. richelementimage (6, CC. color. white, 255, "Res/cocosui/sliderballnormal.png"); // The image is suspended and supports animation CCS. armaturedatamanager. addarmaturefileinfo ("Res/cocosui/100/100. exportjson "); var par = CCS. armature. create ("100"); par. getanimation (). play ("animation1"); var recustom = new ccui. richelementcustomnode (1, CC. color. white, 255, par); // then fight back the image var re6 = new ccui. riche Lementtext (7, CC. color. Orange, 255, "Have fun !! "," Helvetica ", 10); richtext. pushbackelement (RE1); richtext. insertelement (re2, 1); richtext. pushbackelement (RE3); richtext. pushbackelement (RE4); richtext. pushbackelement (re5); richtext. insertelement (reimg, 2); richtext. pushbackelement (recustom); richtext. pushbackelement (re6); richtext. setposition (CC. P (widgetsize. width/2, widgetsize. height/2); this. _ mainnode. addchild (richtext); this. _ richtext = richtext; return true ;}...


This article is from Eric's home_value blog, please be sure to keep this source http://ericyu.blog.51cto.com/2320641/1566102

Cocos2d-x 3.0 Rich Text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.