CrossApp中,整个工程的入口函数是AppDelegate,在AppDelegate中屏蔽了多平台之间的区别,从而实现了跨平台。
言归正传,CrossApp中修改默认打开的Window的方法和Cocos2d-x中是相似的,但是对于没有学习过Cocos2d-x的朋友,还是需要介绍一下。
首先,需要修改一下AppDelegate.cpp中所导入的头文件:
- #include "AppDelegate.h"
- #include "RootWindow.h"<span style="font-size:18px;color:#666666;">
- </span>
修改后:
- #include "AppDelegate.h"
- #include "MainMenuWindow.h"
没修改前:
- bool AppDelegate::applicationDidFinishLaunching()
- {
- // initialize director
- auto pDirector = CAApplication::getApplication();
- CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
- pDirector->setOpenGLView(pEGLView);
- // run
- pDirector->runWindow(RootWindow::create());
- return true;
- }
pDirector->runWindow(MainMenuWindow::create());
修改后如下:
- bool AppDelegate::applicationDidFinishLaunching()
- {
- // initialize director
- auto pDirector = CAApplication::getApplication();
- CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
- pDirector->setOpenGLView(pEGLView);
- // run
- pDirector->runWindow(MainMenuWindow::create());
- return true;
- }<span style="font-size:18px;color:#666666;">
- </span>
原文链接:http://blog.csdn.net/qq446569365/article/details/39121111
CrossApp官网:http://crossapp.9miao.com/
9秒社团官网:http://www.9miao.com/