Merge pull request #6870 from samuele3hu/v3_fix

Move `setSearchPath` operation from cpp to script for lua-tests
This commit is contained in:
James Chen 2014-05-22 03:04:33 -05:00
commit 1bead55e43
4 changed files with 58 additions and 51 deletions

View File

@ -86,6 +86,7 @@
15C90B4B18E66C2F00D69802 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; };
15C90B4C18E66C3100D69802 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; };
15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; };
15E66FD6192DC8C700C20A52 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; };
1A0EE2A118CDF6DA004CD58F /* libchipmunk Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB41807A4F9005B8026 /* libchipmunk Mac.a */; };
1A0EE2A218CDF6DA004CD58F /* libcocos2dx Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2dx Mac.a */; };
1A0EE2A418CDF6DA004CD58F /* libCocosDenshion Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB81807A4F9005B8026 /* libCocosDenshion Mac.a */; };
@ -4287,6 +4288,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
15E66FD6192DC8C700C20A52 /* Sprite3DTest in Resources */,
1AC35DC318CEE65100F37B72 /* Misc in Resources */,
1AC35DC618CEE65100F37B72 /* Shaders in Resources */,
1AC35DBB18CEE65100F37B72 /* components in Resources */,

View File

@ -36,14 +36,9 @@ bool AppDelegate::applicationDidFinishLaunching()
auto designSize = Size(480, 320);
auto pFileUtils = FileUtils::getInstance();
if (screenSize.height > 320)
{
auto resourceSize = Size(960, 640);
std::vector<std::string> searchPaths;
searchPaths.push_back("hd");
pFileUtils->setSearchPaths(searchPaths);
director->setContentScaleFactor(resourceSize.height/designSize.height);
}
@ -58,51 +53,6 @@ bool AppDelegate::applicationDidFinishLaunching()
register_assetsmanager_test_sample(stack->getLuaState());
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
std::string resPrefix("");
#else
std::string resPrefix("res/");
#endif
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
searchPaths.insert(searchPaths.begin(), resPrefix);
searchPaths.insert(searchPaths.begin(), resPrefix + "cocosbuilderRes");
if (screenSize.height > 320)
{
searchPaths.insert(searchPaths.begin(), resPrefix + "hd");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/Images");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/ArmatureComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/AttributeComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/BackgroundComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/EffectComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/LoadSceneEdtiorFileTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/ParticleComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/SpriteComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/TmxMapComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/UIComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/TriggerTest");
}
else
{
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/Images");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/ArmatureComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/AttributeComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/BackgroundComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/EffectComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/LoadSceneEdtiorFileTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/ParticleComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/SpriteComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/TmxMapComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/UIComponentTest");
searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/TriggerTest");
}
FileUtils::getInstance()->setSearchPaths(searchPaths);
pEngine->executeScriptFile("src/controller.lua");
return true;

View File

@ -8,6 +8,61 @@ require "src/mainMenu"
-- run
local glView = cc.Director:getInstance():getOpenGLView()
local screenSize = glView:getFrameSize()
local designSize = {width = 480, height = 320}
local fileUtils = cc.FileUtils:getInstance()
if screenSize.height > 320 then
local searchPaths = {}
table.insert(searchPaths, "hd")
fileUtils:setSearchPaths(searchPaths)
end
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
local resPrefix = ""
if cc.PLATFORM_OS_IPAD == targetPlatform or cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_MAC == targetPlatform then
resPrefix = ""
else
resPrefix = "res/"
end
local searchPaths = fileUtils:getSearchPaths()
table.insert(searchPaths, 1, resPrefix)
table.insert(searchPaths, 1, "cocosbuilderRes")
if screenSize.height > 320 then
table.insert(searchPaths, 1, resPrefix .. "hd")
table.insert(searchPaths, 1, resPrefix .. "ccs-res")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/Images")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/ArmatureComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/AttributeComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/BackgroundComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/EffectComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/LoadSceneEdtiorFileTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/ParticleComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/SpriteComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/TmxMapComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/UIComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/TriggerTest")
else
table.insert(searchPaths, 1, resPrefix .. "ccs-res/Images")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/ArmatureComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/AttributeComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/BackgroundComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/EffectComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/LoadSceneEdtiorFileTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/ParticleComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/SpriteComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/TmxMapComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/UIComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/TriggerTest")
end
fileUtils:setSearchPaths(searchPaths)
local scene = cc.Scene:create()
scene:addChild(CreateTestMenu())
cc.Director:getInstance():runWithScene(scene)

View File

@ -102,7 +102,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
TextureCache::[addPVRTCImage addImageAsync],
Timer::[getSelector createWithScriptHandler],
*::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate onTouch.* onAcc.* onKey.* onRegisterTouchListener],
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getFileData getDataFromFile getFullPathCache],
FileUtils::[getFileData getDataFromFile getFullPathCache],
Application::[^application.* ^run$],
Camera::[getEyeXYZ getCenterXYZ getUpXYZ],
ccFontDefinition::[*],