diff --git a/samples/HelloCpp/Classes/AppDelegate.cpp b/samples/HelloCpp/Classes/AppDelegate.cpp index 557e51d63a..84e2527106 100644 --- a/samples/HelloCpp/Classes/AppDelegate.cpp +++ b/samples/HelloCpp/Classes/AppDelegate.cpp @@ -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); diff --git a/samples/TestCpp/Classes/AppDelegate.cpp b/samples/TestCpp/Classes/AppDelegate.cpp index 07f003403a..01f76e4ecf 100644 --- a/samples/TestCpp/Classes/AppDelegate.cpp +++ b/samples/TestCpp/Classes/AppDelegate.cpp @@ -22,32 +22,26 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - TargetPlatform target = getTargetPlatform(); - - if (target == kTargetIpad) - { - // ipad + CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize(); + CCSize designSize = CCSizeMake(480, 320); - if (pDirector->enableRetinaDisplay(true)) - { - // ipad hd - CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd"); - } - else - { - CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad"); - } - } - else if (target == kTargetIphone) + if (screenSize.height > 768) { - // iphone - - if (pDirector->enableRetinaDisplay(true)) - { - // iphone hd - CCFileUtils::sharedFileUtils()->setResourceDirectory("hd"); - } + CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd"); + pDirector->setContentScaleFactor(1536.0f/designSize.height); } + else if (screenSize.height > 640) + { + CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad"); + pDirector->setContentScaleFactor(768.0f/designSize.height); + } + else if (screenSize.height > 320) + { + 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);