Hello !
I propose to use CCLabelBMFontMultiline class for show multiline strings with BMP-font.
Howto use:
- Copy file “CCLabelBMFont.cpp” from attached archive to “cocos2dx/label_nodes” folder
- Copy file “CCLabelBMFont.h” from attached archive to “cocos2dx/include” folder
- Call subroutine output a line similar to the class CCLabelBMFont (labelWithString) with additional parameters:
width - the width of the output lines in pixels,
align - enum with 3 states (LeftAlignment, CenterAlignment, RightAlignment)
Example using CCLabelBMFontMultiline class:
CCMenuItemSprite* item1 = CCMenuItemSprite::itemFromNormalSprite(spriteNormal1, spriteSelected1, spriteDisabled1, this, menu_selector(MenuLayer1::menuCallback1) );
CCLabelBMFontMultiline* text1 = CCLabelBMFontMultiline::labelWithString(“Hello world !”, “fonts/arial16.fnt”,item1->getContentSize().width, CenterAlignment);
CCLabelBMFont.zip (9.6 KB)