mirror of https://github.com/axmolengine/axmol.git
issue #10257:Fix the error that Draw object display differently on the different platform.
This commit is contained in:
parent
fbd5a09cfd
commit
230899ae32
|
@ -3,6 +3,11 @@
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
|
|
||||||
|
static cocos2d::Size designResolutionSize = cocos2d::Size(480, 320);
|
||||||
|
static cocos2d::Size smallResolutionSize = cocos2d::Size(480, 320);
|
||||||
|
static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024, 768);
|
||||||
|
static cocos2d::Size largeResolutionSize = cocos2d::Size(2048, 1536);
|
||||||
|
|
||||||
AppDelegate::AppDelegate() {
|
AppDelegate::AppDelegate() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +49,25 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
||||||
// set FPS. the default value is 1.0/60 if you don't call this
|
// set FPS. the default value is 1.0/60 if you don't call this
|
||||||
director->setAnimationInterval(1.0 / 60);
|
director->setAnimationInterval(1.0 / 60);
|
||||||
|
|
||||||
|
// Set the design resolution
|
||||||
|
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
|
||||||
|
Size frameSize = glview->getFrameSize();
|
||||||
|
// if the frame's height is larger than the height of medium size.
|
||||||
|
if (frameSize.height > mediumResolutionSize.height)
|
||||||
|
{
|
||||||
|
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
|
||||||
|
}
|
||||||
|
// if the frame's height is larger than the height of small size.
|
||||||
|
else if (frameSize.height > smallResolutionSize.height)
|
||||||
|
{
|
||||||
|
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
|
||||||
|
}
|
||||||
|
// if the frame's height is smaller than the height of medium size.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
|
||||||
|
}
|
||||||
|
|
||||||
register_all_packages();
|
register_all_packages();
|
||||||
|
|
||||||
// create a scene. it's an autorelease object
|
// create a scene. it's an autorelease object
|
||||||
|
|
Loading…
Reference in New Issue