mirror of https://github.com/axmolengine/axmol.git
Merge pull request #5252 from samuele3hu/developBug
issue #3837:Update the “HelloLua” test case to support on-device debugging
This commit is contained in:
commit
31643adb99
|
@ -23,23 +23,24 @@ AppDelegate::~AppDelegate()
|
|||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// initialize director
|
||||
auto pDirector = Director::getInstance();
|
||||
pDirector->setOpenGLView(EGLView::getInstance());
|
||||
auto director = Director::getInstance();
|
||||
director->setOpenGLView(EGLView::getInstance());
|
||||
|
||||
EGLView::getInstance()->setDesignResolutionSize(480, 320, ResolutionPolicy::NO_BORDER);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayStats(true);
|
||||
director->setDisplayStats(true);
|
||||
|
||||
// set FPS. the default value is 1.0/60 if you don't call this
|
||||
pDirector->setAnimationInterval(1.0 / 60);
|
||||
director->setAnimationInterval(1.0 / 60);
|
||||
|
||||
// register lua engine
|
||||
LuaEngine* pEngine = LuaEngine::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||
|
||||
std::string path = FileUtils::getInstance()->fullPathForFilename("hello.lua");
|
||||
pEngine->executeScriptFile(path.c_str());
|
||||
LuaEngine* engine = LuaEngine::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
|
||||
//The call was commented because it will lead to ZeroBrane Studio can't find correct context when debugging
|
||||
//engine->executeScriptFile("hello.lua");
|
||||
engine->executeString("require 'hello.lua'");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ local function main()
|
|||
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) or
|
||||
(cc.PLATFORM_OS_ANDROID == targetPlatform) or (cc.PLATFORM_OS_WINDOWS == targetPlatform) or
|
||||
(cc.PLATFORM_OS_MAC == targetPlatform) then
|
||||
require('mobdebug').start()
|
||||
local host = 'localhost' -- please change localhost to your PC's IP for on-device debugging
|
||||
require('mobdebug').start(host)
|
||||
end
|
||||
require "hello2"
|
||||
cclog("result is " .. myadd(1, 1))
|
||||
|
|
|
@ -33,9 +33,10 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
auto engine = LuaEngine::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
|
||||
std::string path = FileUtils::getInstance()->fullPathForFilename("hello.lua");
|
||||
engine->executeScriptFile(path.c_str());
|
||||
|
||||
//The call was commented because it will lead to ZeroBrane Studio can't find correct context when debugging
|
||||
//engine->executeScriptFile("hello.lua");
|
||||
engine->executeString("require 'hello.lua'");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ local function main()
|
|||
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) or
|
||||
(cc.PLATFORM_OS_ANDROID == targetPlatform) or (cc.PLATFORM_OS_WINDOWS == targetPlatform) or
|
||||
(cc.PLATFORM_OS_MAC == targetPlatform) then
|
||||
require('mobdebug').start()
|
||||
local host = 'localhost' -- please change localhost to your PC's IP for on-device debugging
|
||||
require('mobdebug').start(host)
|
||||
end
|
||||
require "hello2"
|
||||
cclog("result is " .. myadd(1, 1))
|
||||
|
|
Loading…
Reference in New Issue