Cocos2d-x 3.0rc2 - Label alignment not working ?

I’m trying the new Label class, and nomatter how I set the Alignment, the text always ends up in the same position. I’ve tried with empty dimensions, with dimensions set - nothing seems to change where the text ends up on screen.
Anyone got any idea ?

Label * label = Label::createWithTTF("Text", "fonts/Marker Felt.ttf", 96); label->setPosition(Point(someX, someY)); label->setHorizontalAlignment(TextHAlignment::RIGHT); label->setVerticalAlignment(TextVAlignment::BOTTOM);

1 Like

try setting the anchor point (setAnchorPoint()). by default it’s {0.5, 0.5}.

i’m not 100% sure how the alignments interact with the anchor point. i haven’t played with them much.

1 Like

@bunnyhero You are correct. I ran into this same issue and setting anchor point to 0,0 worked:

label->setAnchorPoint({});