I’m using a CCLabelBMFont to display COMBO information like this:
I first create the CCLabelBMFont like this:
_comboDisplay = CCLabelBMFont::create("N-hit\nCOMBO!", "font.fnt", _screenSizeVisible.width * 0.7f, kCCTextAlignmentCenter); _comboDisplay->setAnchorPoint(ccp(0.5f,0.5f)); _comboDisplay->setColor(ccc3(255,247,0)); _comboDisplay->setPosition(ccp(xOffset + _screenSizeVisible.width * 1.5f, _screenSizeVisible.height * 0.75f)); _comboDisplay->setScale((float)COMBO_DISPLAY_SCALE); this->addChild(_comboDisplay, kForeground);
And then, whenever the combo is updated, I do this:
sprintf(szValue, "%i-hit\nCOMBO!", _currentCombo); _comboDisplay->setString (szValue);
So, the problem I have is: after updating the label, that ONE char is shown as at least 2 or 3 new lines: the space between the first and the second lines is HUGE.
If I DON’T update the string since the declaration, then that one char is shown perfectly.
Is there some bug in cocos2d-x 2.1.4 that ends up adding new line characters when sprintf is used? This exact same code doesn’t have this problem in 2.0.4.
Or maybe the way the string is updated has changed since 2.0.4?
Any help is greatly appreciated.