Hi,
I created a Label and LEFT alignment is working on Android device and in iOS simulator but not on my iPhone. Here is the code:
auto labelB4 = Label::createWithSystemFont(TEXT_B4, "", FONT_SIZE);
labelB4->setWidth(winSize.width * texBoxX);
labelB4->setHorizontalAlignment(TextHAlignment::LEFT);
labelB4->setTag(14);
labelB4->setVisible(true);
labelB4->setColor(TEXT_COLOR);
labelB4->setAnchorPoint(Point(0.0,0.5));
labelB4->setPosition(Vec2(winSize.width * texPosX, boutonOut->getContentSize().height / 2));
boutonOut->addChild(labelB4);
If I put TextHAlignment::CENTER or RIGHT then it is ok, but LEFT give me right alignment.
I’v tried to remove the setAnchorPoint(). I’v tried createWithSystemFont() with all parameters (size and both aligments). Tried setMaxLineWidth(), setString() …
Thank you for any help.
UPDATE:
I found that if use exactely the same code as my previous version of the application that was build with cocos2d-x v3.6 (or v3.7 don’t remember) it is working good in that version but not with present code that is compiled with cocos2d-x v3.9
here is the code:
Label* labelB1 = Label::createWithSystemFont(TEXT_B1a, "Arial", FONT_SIZE, Size(winSize.width * texBoxX,winSize.height * texBoxY), TextHAlignment::LEFT, TextVAlignment::CENTER);
labelB1->setTag(11);
labelB1->setVisible(true);
labelB1->setColor(TEXT_COLOR);
labelB1->setAnchorPoint(Point(0.0,0.5));
labelB1->setPosition(Vec2(boutonMD->getRightBoundary() + 22, winSize.height * yB1));
this->addChild(labelB1);