mirror of https://github.com/axmolengine/axmol.git
commit
fae7d5beeb
|
@ -1,5 +1,8 @@
|
|||
#include "AppDelegate.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#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<string> 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);
|
||||
|
|
|
@ -41,20 +41,16 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
if (platform == kTargetIphone || platform == kTargetIpad)
|
||||
{
|
||||
searchPaths.push_back("Published-iOS"); // Resources/Published-iOS
|
||||
searchPaths.push_back(""); // Resources/, we added this searching path since some files such as jsb_cocos2d.js were placed at the root folder.
|
||||
CCFileUtils::sharedFileUtils()->setSearchPath(searchPaths);
|
||||
|
||||
if (screenSize.height > 480)
|
||||
{
|
||||
resourceSize = CCSizeMake(640, 960);
|
||||
resDirOrders.push_back("resources-iphonehd");
|
||||
resDirOrders.push_back("");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
resDirOrders.push_back("resources-iphone");
|
||||
resDirOrders.push_back("");
|
||||
}
|
||||
|
||||
CCFileUtils::sharedFileUtils()->setSearchResolutionsOrder(resDirOrders);
|
||||
|
@ -73,19 +69,16 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
{
|
||||
resourceSize = CCSizeMake(640, 960);
|
||||
resDirOrders.push_back("resources-large");
|
||||
resDirOrders.push_back("");
|
||||
}
|
||||
else if (screenSize.height > 480)
|
||||
{
|
||||
resourceSize = CCSizeMake(480, 720);
|
||||
resDirOrders.push_back("resources-medium");
|
||||
resDirOrders.push_back("");
|
||||
}
|
||||
else
|
||||
{
|
||||
resourceSize = CCSizeMake(320, 568);
|
||||
resDirOrders.push_back("resources-small");
|
||||
resDirOrders.push_back("");
|
||||
}
|
||||
|
||||
CCFileUtils::sharedFileUtils()->setSearchResolutionsOrder(resDirOrders);
|
||||
|
|
Loading…
Reference in New Issue