遇到一个很奇怪的问题,按教程制作了文字菜单后,始终点击无效
之后参考helloworld各种改进实验,终于发现问题出在设置屏幕显示大小上。错误的代码
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("My Game");
//glview->setFrameSize(600,600);
director->setOpenGLView(glview);
}
glview->setFrameSize(600,600);
这里把设置屏幕大小的 glview->setFrameSize() 放到了后面,结果界面上所有的菜单都失效了。更改后菜单可用
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("My Game");
glview->setFrameSize(600,600);
director->setOpenGLView(glview);
}