
刚接触到cocos2d-x3.2版本,发现3.x与2.x版本有很大差别,看下面一段代码
auto closeItem = MenuItemImage::create( "Closenormal.png","CloseSelected.png",CC_CALLBACK_1(HelloWorld::menuCloseCallback,this));
我们明显发现,多了一个 自动类型变量auto,同时,由CcmenuItemImage变成了MenuItemImage。
我们在这里改一下:
auto closeItem = MenuItemImage::create( "Closenormal.png",[](Object *sender) { #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) MessageBox("You pressed the close button. windows Store Apps do not implement a close button.","Alert"); return; #endif Director::getInstance()->end(); #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) exit(0); #endif }); 编译运行程序,编译通过,我们知道,cocos2dx3.0配合c11标准,使得代码逻辑更加紧凑。 总结 以上是内存溢出为你收集整理的cocos2d-x3.x之helloWorld全部内容,希望文章能够帮你解决cocos2d-x3.x之helloWorld所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)