CCLabelBMFont wrong aligned!

Hi, I have tryed to make text aligned with CCLabelBMFont, but doesn’t works…
I used >setAlignment>setAlignment(cocos2d::kCCTextAlignmentCenter) ->setAlignment(cocos2d::kCCTextAlignmentLeft)
and I have the same results :frowning:

Do you have any idea? Help!

Thanks

Stefano

Did TestCpp/LabelTest work ?

James Chen wrote:

Did TestCpp/LabelTest work ?

I have found a workaround, use setAnchorPoint… works fine now….

setAnchorPoint(ccp(0.0f,0.5f)); // left align
setAnchorPoint(ccp(0.5f,0.5f)); // center align
setAnchorPoint(ccp(1.0f,0.5f)); // right align

Is it not possible, fix setAlignment?

Regards!

Stefano Campodall’Orto wrote:

James Chen wrote:
> Did TestCpp/LabelTest work ?
>
I have found a workaround, use setAnchorPoint… works fine now….
>
setAnchorPoint(ccp(0.0f,0.5f)); // left align
setAnchorPoint(ccp(0.5f,0.5f)); // center align
setAnchorPoint(ccp(1.0f,0.5f)); // right align
>
Is it not possible, fix setAlignment?
>
Regards!

Is setAlignment designed to set the position of the text within the node?

If your node is the same width/height as the text then it will make no difference.

i.e.
————————

  • Some Text in a label-
    ————————

In this case there is nowhere for the text to go.

If your node was bigger than the text then if might do what you are expecting.
i.e.
————————————

  • Center aligned -
    ————————————

  • Left aligned -
    ————————————

  • Right aligned-
    ————————————