cocos2d-xでプログラム開発を行っているのですが、構文の記載方法でわからないことがあり、質問をさせて頂きます。
どうぞ、よろしくお願い致します。
<質問内容>
cocos2d-x V3.10を使用してプログラム開発をしています。
その中で、画面遷移用のボタンを配置する関数を使用し、ボタンクリック時にint型の変数値を代入した名称のシーンへ画面遷移する作りを行いたいのですが、エラーとなります。
ネットなどを用いて、変数代入について調べたのですが、解決策を見つけられませんでした。
こちらはどのように修正を行えばよいでしょうか?
[現在の記載内容(抜粋)]※実際にはaaには毎回異なる変数を入れる予定です。
int aa = 1;
auto MakeButton = MenuItemImage::create(
button1.png,
button2.pmg,
[](Ref* ref){
auto scenename = StringUtils::format("AA%dScene::createScene();", aa);
auto BBB = TransitionFade::create(0.5,scenename);
Director::getInstance()->replaceScene(BBB);
});
auto ButtonMenu = Menu::create(MakeButton, NULL);
ButtonMenu->setPosition(40,100);
this->addChild(ButtonMenu);
[エラー内容]
①auto scenenameで始まる行について
variable 'aa' cannot be implicitly caputred in lambda with no caputure-default specsfied
②auto BBBで始まる行について
No matching function for call to 'create'
以上
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/03/20 12:04
2017/03/20 12:55
2017/03/21 00:14