「Cocos2dx/MenuItemImage」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==サンプル画像ボタン== bool HelloWorld::init() { // 略 auto showButton = MenuItemImage::create("button.png", "button_selected.png",...」) |
|||
| (同じ利用者による、間の1版が非表示) | |||
| 行15: | 行15: | ||
} | } | ||
| − | + | button.pngなど画像ファイルはResourceディレクトリの下に置く | |
==画像サイズ== | ==画像サイズ== | ||
画像を大きくすれば、そのまま反映される | 画像を大きくすれば、そのまま反映される | ||
2018年9月21日 (金) 19:08時点における最新版
サンプル画像ボタン
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ディレクトリの下に置く
画像サイズ
画像を大きくすれば、そのまま反映される
