tibia-client/modules/client/client.lua

45 lines
1.3 KiB
Lua
Raw Normal View History

2012-01-05 02:28:29 +01:00
Client = {}
2012-01-06 10:35:48 +01:00
local function setupWindow()
2011-12-30 07:36:10 +01:00
g_window.show()
2012-01-06 10:35:48 +01:00
g_window.setMinimumSize({ width = 600, height = 480 })
2011-12-30 07:36:10 +01:00
2011-12-30 05:50:19 +01:00
-- initialize in fullscreen mode on mobile devices
if g_window.getPlatformType() == "X11-EGL" then
2011-12-30 07:05:32 +01:00
g_window.setFullscreen(true)
2011-12-30 05:50:19 +01:00
else
2012-01-06 09:48:59 +01:00
-- window size
local size = { width = 800, height = 600 }
size = Settings.getSize('window-size', size)
2012-01-03 02:32:34 +01:00
g_window.resize(size)
2012-01-06 09:48:59 +01:00
-- window position, default is the screen center
2012-01-03 02:32:34 +01:00
local displaySize = g_window.getDisplaySize()
local pos = { x = (displaySize.width - size.width)/2,
y = (displaySize.height - size.height)/2 }
2012-01-06 10:10:55 +01:00
pos = Settings.getPoint('window-pos', pos)
2012-01-03 02:32:34 +01:00
g_window.move(pos)
2012-01-06 09:48:59 +01:00
-- window maximized?
local maximized = Settings.getBoolean('window-maximized', false)
if maximized then g_window.maximize() end
2011-12-30 05:50:19 +01:00
end
2011-12-30 07:36:10 +01:00
g_window.setTitle('OTClient')
2012-01-05 02:28:29 +01:00
g_window.setIcon(resolvepath('clienticon.png'))
2012-01-06 10:35:48 +01:00
end
function Client.init()
setupWindow()
2012-01-05 02:28:29 +01:00
if not g_sprites.isLoaded() or not g_thingsType.isLoaded() then
2012-01-06 10:35:48 +01:00
fatal("spr and dat files are not loaded, are them missing?")
2012-01-05 02:28:29 +01:00
end
end
2011-12-05 19:27:07 +01:00
function Client.terminate()
2012-01-06 09:48:59 +01:00
Settings.set('window-size', g_window.getUnmaximizedSize())
Settings.set('window-pos', g_window.getUnmaximizedPos())
Settings.set('window-maximized', g_window.isMaximized())
end