Is there common way of creating a batch of nodes in cocos2d, especially ui::Text
?
Since I’m using cocos2d::ui::Text::create
, a lot of the time spent within is spent looking for fonts and getting the content size of the label, for alignment and positioning.
Without going into too much detail about my own uses, and assuming I’ve tried stuff like caching and lazy updating, is there a way to bulk-create a bunch of ui::Text
s?
This is more informational than for diagnosis, but here’s a performance capture with Very Sleepy during a 10s where I’m repeatedly creating the widgets on hover. The columns are Exclusive/Inclusive/Exclusive %/Inclusive %, sorted by Inclusive time.
It creates a few Layouts, and then adds in a few dozen Texts with text content, then scans the Texts for markers for coloring, then goes through the letters and changes their colors based on those markers. Then it chooses a font name and size, then it adds each Text to the parent Layout.