mirror of https://github.com/axmolengine/axmol.git
Updating file search logic for CocosDragonJS.
This commit is contained in:
parent
f0c2d310ee
commit
e1f6c37c2f
|
@ -38,27 +38,71 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
CCSize designSize = CCSizeMake(320, 480);
|
CCSize designSize = CCSizeMake(320, 480);
|
||||||
CCSize resourceSize = CCSizeMake(320, 480);
|
CCSize resourceSize = CCSizeMake(320, 480);
|
||||||
|
|
||||||
vector<string> searchPath;
|
std::vector<std::string> resDirOrders;
|
||||||
|
|
||||||
if (screenSize.height > 768)
|
TargetPlatform platform = CCApplication::sharedApplication()->getTargetPlatform();
|
||||||
|
if (platform == kTargetIphone || platform == kTargetIpad)
|
||||||
|
{
|
||||||
|
if (screenSize.height > 1024)
|
||||||
{
|
{
|
||||||
resourceSize = CCSizeMake(1536, 2048);
|
resourceSize = CCSizeMake(1536, 2048);
|
||||||
searchPath.push_back("resources-ipadhd");
|
resDirOrders.push_back("resources-ipadhd");
|
||||||
|
resDirOrders.push_back("resources-ipad");
|
||||||
|
resDirOrders.push_back("resources-iphonehd");
|
||||||
}
|
}
|
||||||
else if (screenSize.height > 640)
|
else if (screenSize.height > 960)
|
||||||
{
|
{
|
||||||
resourceSize = CCSizeMake(768, 1536);
|
resourceSize = CCSizeMake(768, 1024);
|
||||||
searchPath.push_back("resources-ipad");
|
resDirOrders.push_back("resources-ipad");
|
||||||
|
resDirOrders.push_back("resources-iphonehd");
|
||||||
}
|
}
|
||||||
else if (screenSize.height > 320)
|
else if (screenSize.height > 480)
|
||||||
{
|
{
|
||||||
resourceSize = CCSizeMake(640, 960);
|
resourceSize = CCSizeMake(640, 960);
|
||||||
searchPath.push_back("resources-iphonehd");
|
resDirOrders.push_back("resources-iphonehd");
|
||||||
|
resDirOrders.push_back("resources-iphone");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resourceSize = CCSizeMake(320, 480);
|
||||||
|
resDirOrders.push_back("resources-iphone");
|
||||||
}
|
}
|
||||||
|
|
||||||
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
|
}
|
||||||
|
else if (platform == kTargetAndroid || platform == kTargetWindows)
|
||||||
|
{
|
||||||
|
CCLOG("screen size [%f, %f]", screenSize.width, screenSize.height);
|
||||||
|
if (screenSize.height > 960)
|
||||||
|
{
|
||||||
|
resourceSize = CCSizeMake(1280, 1920);
|
||||||
|
resDirOrders.push_back("resources-xlarge");
|
||||||
|
resDirOrders.push_back("resources-large");
|
||||||
|
resDirOrders.push_back("resources-medium");
|
||||||
|
resDirOrders.push_back("resources-small");
|
||||||
|
}
|
||||||
|
else if (screenSize.height > 720)
|
||||||
|
{
|
||||||
|
resourceSize = CCSizeMake(640, 960);
|
||||||
|
resDirOrders.push_back("resources-large");
|
||||||
|
resDirOrders.push_back("resources-medium");
|
||||||
|
resDirOrders.push_back("resources-small");
|
||||||
|
}
|
||||||
|
else if (screenSize.height > 480)
|
||||||
|
{
|
||||||
|
resourceSize = CCSizeMake(480, 720);
|
||||||
|
resDirOrders.push_back("resources-medium");
|
||||||
|
resDirOrders.push_back("resources-small");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resourceSize = CCSizeMake(320, 480);
|
||||||
|
resDirOrders.push_back("resources-small");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
|
CCFileUtils::sharedFileUtils()->setSearchResolutionsOrder(resDirOrders);
|
||||||
|
|
||||||
|
pDirector->setContentScaleFactor(resourceSize.width/designSize.width);
|
||||||
|
|
||||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
|
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
COCOS2DX_ROOT="$DIR/../../../.."
|
COCOS2DX_ROOT="$DIR/../../../.."
|
||||||
APP_ROOT="$DIR/.."
|
APP_ROOT="$DIR/.."
|
||||||
APP_ANDROID_ROOT="$DIR"
|
APP_ANDROID_ROOT="$DIR"
|
||||||
RESROUCE_ROOT="$APP_ROOT/../Shared/games/CocosDragonJS/Published files iOS"
|
RESROUCE_ROOT="$APP_ROOT/../Shared/games/CocosDragonJS/Published files Android"
|
||||||
BINDINGS_JS_ROOT="$APP_ROOT/../../../scripting/javascript/bindings/js"
|
BINDINGS_JS_ROOT="$APP_ROOT/../../../scripting/javascript/bindings/js"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -69,11 +69,14 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
{
|
{
|
||||||
resourceSize = CCSizeMake(640, 960);
|
resourceSize = CCSizeMake(640, 960);
|
||||||
resDirOrders.push_back("resources-large");
|
resDirOrders.push_back("resources-large");
|
||||||
|
resDirOrders.push_back("resources-medium");
|
||||||
|
resDirOrders.push_back("resources-small");
|
||||||
}
|
}
|
||||||
else if (screenSize.height > 480)
|
else if (screenSize.height > 480)
|
||||||
{
|
{
|
||||||
resourceSize = CCSizeMake(480, 720);
|
resourceSize = CCSizeMake(480, 720);
|
||||||
resDirOrders.push_back("resources-medium");
|
resDirOrders.push_back("resources-medium");
|
||||||
|
resDirOrders.push_back("resources-small");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue