Cocos 2d-x:左对齐菜单

时间:2014-06-20 09:41:05

标签: c++ user-interface cocos2d-x

菜单默认菜单中的中心菜单项,但我想要左对齐菜单,如截图。

enter image description here

如何创建左对齐菜单?感谢。

UPD: 这就是我创建菜单的方式:

    cocos2d::MenuItemFont::setFontSize(FONT_SIZE_ITEMS);
cocos2d::MenuItemFont::setFontName(FONT_NAME);

auto pMenu = Menu::create(
    MenuItemFont::create("How To Play", CC_CALLBACK_1(BMSettingsLayer::onHowToPressed, this)),
    this->soundMenuItem(),
    this->musicMenuItem(),
    MenuItemFont::create("Buy Lives",CC_CALLBACK_1(BMSettingsLayer::onBuyLivesPressed, this)),
    MenuItemFont::create("Remove Ads", CC_CALLBACK_1(BMSettingsLayer::onRemoveAdsPressed, this)),
    MenuItemFont::create("Rates",CC_CALLBACK_1(BMSettingsLayer::onRatesPressed, this)),
    MenuItemFont::create("Contact",CC_CALLBACK_1(BMSettingsLayer::onContactsPressed, this)),
    nullptr);

pMenu->setPosition(Point(winSize.width * 0.55, winSize.height*0.5));
pMenu->alignItemsVertically();
pMenu->setColor(Color3B::BLACK);
this->addChild(pMenu);

0 个答案:

没有答案