mirror of https://github.com/axmolengine/axmol.git
Android also uses executeScript to load lua source file or byte code file. So unused codes need to be deleted.
This commit is contained in:
parent
862ce85c7a
commit
5337234e22
|
@ -38,17 +38,9 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
|
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
|
||||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
||||||
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
|
|
||||||
if (pstrFileContent)
|
|
||||||
{
|
|
||||||
pEngine->executeString(pstrFileContent->getCString());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
||||||
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
||||||
pEngine->executeScriptFile(path.c_str());
|
pEngine->executeScriptFile(path.c_str());
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,11 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
std::string dirPath = "luaScript";
|
std::string dirPath = "luaScript";
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
||||||
CCString* pstrFileContent = CCString::createWithContentsOfFile((dirPath + "/controller.lua").c_str());
|
|
||||||
if (pstrFileContent)
|
|
||||||
{
|
|
||||||
pEngine->executeString(pstrFileContent->getCString());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename((dirPath + "/controller.lua").c_str());
|
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename((dirPath + "/controller.lua").c_str());
|
||||||
pEngine->addSearchPath(path.substr(0, path.find_last_of("/") - dirPath.length()).c_str());
|
pEngine->addSearchPath(path.substr(0, path.find_last_of("/") - dirPath.length()).c_str());
|
||||||
pEngine->executeScriptFile(path.c_str());
|
pEngine->executeScriptFile(path.c_str());
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,17 +42,10 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
|
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
|
||||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
||||||
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
|
|
||||||
if (pstrFileContent)
|
|
||||||
{
|
|
||||||
pEngine->executeString(pstrFileContent->getCString());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
||||||
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
||||||
pEngine->executeScriptFile(path.c_str());
|
pEngine->executeScriptFile(path.c_str());
|
||||||
#endif
|
|
||||||
[! else]
|
[! else]
|
||||||
// create a scene. it's an autorelease object
|
// create a scene. it's an autorelease object
|
||||||
CCScene *pScene = HelloWorld::scene();
|
CCScene *pScene = HelloWorld::scene();
|
||||||
|
|
|
@ -33,17 +33,9 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
|
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
|
||||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
||||||
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
|
|
||||||
if (pstrFileContent)
|
|
||||||
{
|
|
||||||
pEngine->executeString(pstrFileContent->getCString());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
||||||
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
||||||
pEngine->executeScriptFile(path.c_str());
|
pEngine->executeScriptFile(path.c_str());
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,9 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
|
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
|
||||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
||||||
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
|
|
||||||
if (pstrFileContent)
|
|
||||||
{
|
|
||||||
pEngine->executeString(pstrFileContent->getCString());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
||||||
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
||||||
pEngine->executeScriptFile(path.c_str());
|
pEngine->executeScriptFile(path.c_str());
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,17 +37,9 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
CCScriptEngineProtocol* pEngine = CCLuaEngine::engine();
|
CCScriptEngineProtocol* pEngine = CCLuaEngine::engine();
|
||||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
||||||
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
|
|
||||||
if (pstrFileContent)
|
|
||||||
{
|
|
||||||
pEngine->executeString(pstrFileContent->getCString());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
|
||||||
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
||||||
pEngine->executeScriptFile(path.c_str());
|
pEngine->executeScriptFile(path.c_str());
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue