Cocos2dx/MenuItemImage
提供: 初心者エンジニアの簡易メモ
サンプル画像ボタン
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ディレクトリの下に置く
画像サイズ
画像を大きくすれば、そのまま反映される
