Cocos2dx/MenuItemImage
提供: 初心者エンジニアの簡易メモ
2018年9月21日 (金) 18:51時点におけるAdmin (トーク | 投稿記録)による版 (ページの作成:「==サンプル画像ボタン== bool HelloWorld::init() { // 略 auto showButton = MenuItemImage::create("button.png", "button_selected.png",...」)
サンプル画像ボタン
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");
}
Resourceの下にbutton.pngなどを置く
画像サイズ
画像を大きくすれば、そのまま反映される
