On cocos2d ObjectiveC I use NSMutableParagraphStyle with alignement NSTextAlignmentJustified and when I create my label I use CCLabelTTF labelWithAttributedString…
He dont have equivalent on cocos2d-x… someone have already do this or can help ?
Hi, everyone, we are developing on game and we need exactly this thing, but we are still new to all this, so can anyone tell how can we done it, any example or sample @slackmoehrle@sevent7@NMCarl
I can try to play with this if I have time, but I’m pretty busy these days. Perhaps start with cocos new and just add a label and start playing around. If you get close, send me the code that I can just drop in to a new project and help too.
@slackmoehrle oh that’s great, well we were trying and find this code from stack overflow
and it’s work with CPP and when we pass the string to this function and print with cocos2d::log() it print with justify, but then when we pass it to label, richtext it just doesn’t work, can you look into it we are so close, hope you will get time…
this is the singleton file… and you can call it from thereSingleton.cpp (12.3 KB) Singleton.h (3.2 KB)
you can call
auto verString = Singleton::getInstance()->justifyText(“Poker is a family of card games that combines gambling, strategy and skill.All poker Variant involve betting as an intrinsic part of play and determine the winner of each hand according to the combinations of players’ cards, at least some of which remain hidden untill the end of the hand.Poker games vary in the number of cards dealt,the number of shared or ‘community’ cards, the number of cards that remain hidden,and the betting procedures.”);