heliclei/cocos2d-x — pull request #26 by heliclei (2014-04-25 10:32:25+00:00)
Title: Batching of Label rendering.

Label is now derived from Node. Every characters is a Sprite added to that node. Render will batch them like other Sprites.

Problems left:
- render problems BMFonts
- set/getBlendMode not supported yet.
- inefficient code as character sprites are added/removed every time. Add caching.
- shadow and distant field not supported

The code is way more simple as there is no special rendering involved. The Label class does have too much legacy code and is very hard to read and maintain. Many code parts are only used when a Label is created in a special way. Also the API for the user is hard too understand. This should be cleaned up. I would drop some legacy code. Is there any need for the LabelTTF class and the LabelBMFont class anymore. They are already using the Label class and lots of code is there to handle these special cases.

This is not the most efficient way to draw labels. Each character is a Sprite and the Renderer will have to copy the quad of each sprite to a single array before it will be drawn in one batch. One idea to fix this is to allow a Sprite to have more than one quad.

This pull request is for starting the discussion.