fixes for ARM

This commit is contained in:
Eduardo Bart 2011-12-30 04:05:32 -02:00
parent 238c66f26c
commit d6e818e648
3 changed files with 17 additions and 3 deletions

View File

@ -4,7 +4,7 @@ Client = { }
function Client.init() function Client.init()
-- initialize in fullscreen mode on mobile devices -- initialize in fullscreen mode on mobile devices
if g_window.getPlatformType() == "X11-EGL" then if g_window.getPlatformType() == "X11-EGL" then
g_window:setFullscreen(true) g_window.setFullscreen(true)
else else
g_window.move({ x=220, y=220 }) g_window.move({ x=220, y=220 })
g_window.resize({ width=800, height=480 }) g_window.resize({ width=800, height=480 })

View File

@ -32,10 +32,25 @@ function createEnvironment()
return env return env
end end
function getCallingScriptSourcePath(depth)
depth = depth or 2
local info = debug.getinfo(1+depth, "Sn")
local path
if info.short_src then
path = info.short_src:match("(.*)/.*")
end
if not path then
path = '/'
elseif path:sub(0, 1) ~= '/' then
path = '/' .. path
end
return path
end
function resolveFileFullPath(filePath, depth) function resolveFileFullPath(filePath, depth)
depth = depth or 1 depth = depth or 1
if filePath:sub(0, 1) ~= '/' then if filePath:sub(0, 1) ~= '/' then
return getCurrentSourcePath(depth+1) .. '/' .. filePath return getCallingScriptSourcePath(depth+1) .. '/' .. filePath
else else
return filePath return filePath
end end

View File

@ -237,5 +237,4 @@ void Application::registerLuaFunctions()
g_lua.bindGlobalFunction("setDefaultFont", std::bind(&FontManager::setDefaultFont, &g_fonts, _1)); g_lua.bindGlobalFunction("setDefaultFont", std::bind(&FontManager::setDefaultFont, &g_fonts, _1));
g_lua.bindGlobalFunction("loadUI", std::bind(&UIManager::loadUI, &g_ui, _1, _2)); g_lua.bindGlobalFunction("loadUI", std::bind(&UIManager::loadUI, &g_ui, _1, _2));
g_lua.bindGlobalFunction("getRootWidget", std::bind(&UIManager::getRootWidget, &g_ui)); g_lua.bindGlobalFunction("getRootWidget", std::bind(&UIManager::getRootWidget, &g_ui));
g_lua.bindGlobalFunction("getCurrentSourcePath", std::bind(&LuaInterface::getCurrentSourcePath, &g_lua, _1));
} }