I tried the following code:
auto chatTextSize = CCSizeMake(300,200); CCLabelTTF *chatText = CCLabelTTF::create("This is supposed to be extremely long text that wraps.", "Marker Felt", 24, chatTextSize, kCCTextAlignmentLeft, kCCVerticalTextAlignmentTop); chatText->setPosition(ccp(chatTextSize.width/2,chatTextSize.height/2)); layer->addChild(chatText);
But it seems like CCLabelTTF has no capability to wrap test on spaces rather than on letters. This makes the use of this label component extremely limited for wrapping text.
I’ve seen the code here: http://www.cocos2d-x.org/wiki/How_does_CCLabelTTF_support_line_breaks_and_wrapping
And I’m not sure if they just get lucky with the numbers, but their breaks seem to occur on spaces. What am I missing? Is it the way I’m creating my label?