Configuration of Multiple resolution in cocos2d-x 3.0
SDK in use: Cocos2d-x 3.0
Orientation: Portrait (not sure for landscape)
How to use:
- Add the method "setupResolutionPolicy" in AppDelegate.cpp
- Call the method inside AppDelegate::applicationDidFinishLaunchingright afterdirector->setOpenGLView(eglView);
Method: setupResolutionPolicy
void setupResolutionPolicy(float designW, float designH)
{
      Size screenSize = EGLView::getInstance()->getFrameSize();
     float designRatio = designW / designH;
     float screenRatio = screenSize.height / screenSize.width;
     ResolutionPolicy resolutionPolicy = screenRatio < designRatio ?
               ResolutionPolicy::FIXED_HEIGHT : ResolutionPolicy::FIXED_WIDTH;
    EGLView::getInstance()->setDesignResolutionSize(designW, designH, resolutionPolicy);
}Written by Ken Lee
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Cocos2d-x 
Authors
Related Tags
#cocos2d-x
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

