例子:屏幕 5S 1136X640
图片 1534X864
AppDelegate.cpp
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("My Game");
director->setOpenGLView(glview);
glview->setDesignResolutionSize(1136.0f, 640.0f, ResolutionPolicy::FIXED_HEIGHT);
}
director->setContentScaleFactor(864.0f / 640.0f);
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
auto scene = GameScene::creatScene();
// run
director->runWithScene(scene);
return true;
}