diff --git a/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp b/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp index 52f1dca3ff..53b1ab1fa9 100644 --- a/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp +++ b/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp @@ -1,5 +1,8 @@ #include "AppDelegate.h" +#include +#include + #include "cocos2d.h" #include "SimpleAudioEngine.h" #include "ScriptingCore.h" @@ -11,6 +14,7 @@ USING_NS_CC; using namespace CocosDenshion; +using namespace std; AppDelegate::AppDelegate() { @@ -34,23 +38,26 @@ bool AppDelegate::applicationDidFinishLaunching() CCSize designSize = CCSizeMake(320, 480); CCSize resourceSize = CCSizeMake(320, 480); + vector searchPath; + if (screenSize.height > 768) { resourceSize = CCSizeMake(1536, 2048); - CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-ipadhd"); + searchPath.push_back("resources-ipadhd"); } else if (screenSize.height > 640) { resourceSize = CCSizeMake(768, 1536); - CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-ipad"); + searchPath.push_back("resources-ipad"); } else if (screenSize.height > 320) { resourceSize = CCSizeMake(640, 960); - CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-iphonehd"); - + searchPath.push_back("resources-iphonehd"); } + CCFileUtils::sharedFileUtils()->setSearchPath(searchPath); + pDirector->setContentScaleFactor(resourceSize.height/designSize.height); CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);