diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index a210b34307..479ff9081c 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -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 */, diff --git a/tests/lua-tests/project/Classes/AppDelegate.cpp b/tests/lua-tests/project/Classes/AppDelegate.cpp index a49f931cfe..cbcd0f6821 100644 --- a/tests/lua-tests/project/Classes/AppDelegate.cpp +++ b/tests/lua-tests/project/Classes/AppDelegate.cpp @@ -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 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 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; diff --git a/tests/lua-tests/src/controller.lua b/tests/lua-tests/src/controller.lua index 2ccad7250d..9a9d863513 100644 --- a/tests/lua-tests/src/controller.lua +++ b/tests/lua-tests/src/controller.lua @@ -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) diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index e35bb9d96e..0e182c71e9 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -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::[*],