关于Cocos2dx屏幕适配

来源:互联网 发布:浙大宁波软件学院 编辑:程序博客网 时间:2024/06/06 02:25
//在 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);}
 1 enum 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 original10     // aspect ratio of the application. Borders can appear on two sides of the application.11     kResolutionShowAll,12 13     kResolutionUnKnown,14 };

0 0
原创粉丝点击