mirror of https://github.com/axmolengine/axmol.git
issue #1486: Calculate content scale factor by screen height.
This commit is contained in:
parent
6178594068
commit
36600d95b1
|
@ -23,17 +23,17 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
|||
if (screenSize.height > 768)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd");
|
||||
pDirector->setContentScaleFactor(2048.0f/kDesignResolutionSize_width);
|
||||
pDirector->setContentScaleFactor(1536.0f/kDesignResolutionSize_height);
|
||||
}
|
||||
else if (screenSize.height > 320)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad");
|
||||
pDirector->setContentScaleFactor(1024.0f/kDesignResolutionSize_width);
|
||||
pDirector->setContentScaleFactor(768.0f/kDesignResolutionSize_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("iphone");
|
||||
pDirector->setContentScaleFactor(480.0f/kDesignResolutionSize_width);
|
||||
pDirector->setContentScaleFactor(320.0f/kDesignResolutionSize_height);
|
||||
}
|
||||
|
||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(kDesignResolutionSize_width, kDesignResolutionSize_height, kResolutionNoBorder);
|
||||
|
|
|
@ -22,32 +22,26 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
CCDirector *pDirector = CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
|
||||
|
||||
TargetPlatform target = getTargetPlatform();
|
||||
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
|
||||
CCSize designSize = CCSizeMake(480, 320);
|
||||
|
||||
if (target == kTargetIpad)
|
||||
if (screenSize.height > 768)
|
||||
{
|
||||
// ipad
|
||||
|
||||
if (pDirector->enableRetinaDisplay(true))
|
||||
{
|
||||
// ipad hd
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd");
|
||||
pDirector->setContentScaleFactor(1536.0f/designSize.height);
|
||||
}
|
||||
else
|
||||
else if (screenSize.height > 640)
|
||||
{
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad");
|
||||
pDirector->setContentScaleFactor(768.0f/designSize.height);
|
||||
}
|
||||
}
|
||||
else if (target == kTargetIphone)
|
||||
else if (screenSize.height > 320)
|
||||
{
|
||||
// iphone
|
||||
|
||||
if (pDirector->enableRetinaDisplay(true))
|
||||
{
|
||||
// iphone hd
|
||||
CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
|
||||
pDirector->setContentScaleFactor(640.0f/designSize.height);
|
||||
}
|
||||
}
|
||||
|
||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayStats(true);
|
||||
|
|
Loading…
Reference in New Issue