Adding embedded image between text in a label

Continuing the discussion from Text label with small pictures in it:

Hi there, I realize this functionality may not be present at the moment, but I’m willing to have a go at adding the support for it myself.

What I specifically require is the ability to add an image in between text, for instance:

“Please click [image] to continue”, where image is either a 2D texture or sprite.

To support this, when using label->setString(), we could perhaps pass a string with args that may be processed with information about the sprite or texture we want to display.

An example, creating a new setString method that accepts a variable list of parameters:

label->setString(“Please click %i to continue”, spritePointer);

where %i indicates an image sprite that should appear in that location.

If someone who understands how the Label system works, then I would appreciate it if you could just give me a few bits of information so I can get this started. More specifically, where does the text to character sprite creation take place in the code, where is it stored, and where is it rendered?

Hi @R101,

If you want to have an image in between Label, You can make use of RichText widget.
It might help full for your criteria.

Little desciption on Richtext Can be found here
http://www.cocos2d-x.org/wiki/UI

Regards,
Gurudath

Thanks Gurudath, I’ll look into using a RichText widget.