facebook twitter hatena line email

Cocos2dx/MenuItemImage

提供: 初心者エンジニアの簡易メモ
2018年9月21日 (金) 19:08時点におけるAdmin (トーク | 投稿記録)による版

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

サンプル画像ボタン

bool HelloWorld::init()
{
    // 略
    auto showButton = MenuItemImage::create("button.png", "button_selected.png",
                                               CC_CALLBACK_1(HelloWorld::push_Button, this));
    showButton->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height * 0.6f + origin.y));
    auto menu_show = Menu::create(showButton, NULL);
    menu_show->setPosition(Point::ZERO);
    this->addChild(menu_show, 1);
}
void HelloWorld::push_Button(Ref *pSender)
{
    log("show button");
}

button.pngなど画像ファイルはResourceディレクトリの下に置く

画像サイズ

画像を大きくすれば、そのまま反映される