//在 bool AppDelegate::applicationDidFinishLaunching() 函数中加入
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if (!glview) {
glview = GLView::create("My Game");
//设置分辨率
glview->setFrameSize(480, 320);
//code
//这句必须最后,根据480,320来适配
glview->setDesignResolutionSize(480, 320, kResolutionShowAll);
director->setOpenGLView(glview);
}
1enum ResolutionPolicy
2 {
3// The entire application is visible in the specified area without trying to preserve the original aspect ratio.
4// Distortion can occur, and the application may appear stretched or compressed. 5 kResolutionExactFit,
6// The entire application fills the specified area, without distortion but possibly with some cropping,
7// while maintaining the original aspect ratio of the application. 8 kResolutionNoBorder,
9// The entire application is visible in the specified area without distortion while maintaining the original
10// aspect ratio of the application. Borders can appear on two sides of the application.11 kResolutionShowAll,
1213 kResolutionUnKnown,
14 };