samedi 27 juin 2015

cocos2dx - Alignment with LabelBMFont

I am trying and struggling to align the BMFontLabel with a sprite side by side. I am using code below to show score of the game with a coin on the left, and score on the right side..

Sprite *coin=Sprite::create("coinimg.png");
Label *scoreLbl=Label::createWithBMFont(GameConfig::scoreBigFont, strScore);
scoreLbl->setScale(.5);

MenuItemSprite *itemCoin=MenuItemSprite::create(coin);
MenuItemLabel *itemScore=MenuItemLabel::create(scoreLbl);

Menu *mainMenu=Menu::create(itemCoin,itemScore, NULL);

mainMenu->alignItemsHorizontallyWithPadding(0.0);

mainMenu->setPosition(Vec2(winsize.width*.1,winsize.height*.8));

The problem is I am getting is different alignments with different values I input like in image.

Thanks for help.

Aucun commentaire:

Enregistrer un commentaire