Last active
August 29, 2015 14:01
-
-
Save tklee1975/d6cca60bf94a6ddc4088 to your computer and use it in GitHub Desktop.
Setup Multiple Resolution in cocos2d-x 3.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setupResolutionPolicy(float designW, float designH) | |
{ | |
GLView *view = Director::getInstance()->getOpenGLView(); | |
Size screenSize = view->getFrameSize(); | |
float designRatio = designW / designH; | |
float screenRatio = screenSize.height / screenSize.width; | |
ResolutionPolicy resolutionPolicy = screenRatio < designRatio ? | |
ResolutionPolicy::FIXED_HEIGHT : ResolutionPolicy::FIXED_WIDTH; | |
view->setDesignResolutionSize(designW, designH, resolutionPolicy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place the above method inside AppDelegate.cpp;
And call it inside applicationDidFinishLaunching after the statement " auto glview = director->getOpenGLView();"