Cocos2d-x在运行时候修改分辨率

下面是Cocos2d-x在运行时候修改分辨率:

 cocos2d::CCEGLView* eglView = cocos2d::CCEGLView::sharedOpenGLView();
 cocos2d::CCDirector* pDirector = cocos2d::CCDirector::sharedDirector();

 if ( eglView == NULL || pDirector == NULL )
 {
  return false;
 }

 eglView->setFrameSize(width, height);

 eglView->setDesignResolutionSize(width, height, kResolutionNoBorder);

 cocos2d::CCScene *pScene = HelloWorld::scene();
 pDirector->replaceScene(pScene);

Cocos2D-X 的详细介绍:请点这里
Cocos2D-X 的下载地址:请点这里

相关推荐