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

2014-11-23 20:01:21 · 作者: · 浏览: 38

下面是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);