mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 12:04:55 +02:00
Finished stable implementation (as far as tested), still requires more testing.
This commit is contained in:
@@ -65,20 +65,20 @@ function init()
|
||||
else
|
||||
-- window size
|
||||
local size = { width = 800, height = 600 }
|
||||
size = g_settings.getSize('window-size', size)
|
||||
size = g_settings:getSize('window-size', size)
|
||||
g_window.resize(size)
|
||||
|
||||
-- window position, default is the screen center
|
||||
local displaySize = g_window.getDisplaySize()
|
||||
local defaultPos = { x = (displaySize.width - size.width)/2,
|
||||
y = (displaySize.height - size.height)/2 }
|
||||
local pos = g_settings.getPoint('window-pos', defaultPos)
|
||||
local pos = g_settings:getPoint('window-pos', defaultPos)
|
||||
pos.x = math.max(pos.x, 0)
|
||||
pos.y = math.max(pos.y, 0)
|
||||
g_window.move(pos)
|
||||
|
||||
-- window maximized?
|
||||
local maximized = g_settings.getBoolean('window-maximized', false)
|
||||
local maximized = g_settings:getBoolean('window-maximized', false)
|
||||
if maximized then g_window.maximize() end
|
||||
end
|
||||
|
||||
@@ -91,9 +91,9 @@ function init()
|
||||
g_keyboard.bindKeyDown('Ctrl+Shift+R', reloadScripts)
|
||||
|
||||
-- generate machine uuid, this is a security measure for storing passwords
|
||||
if not g_crypt.setMachineUUID(g_settings.get('uuid')) then
|
||||
g_settings.set('uuid', g_crypt.getMachineUUID())
|
||||
g_settings.save()
|
||||
if not g_crypt.setMachineUUID(g_settings:get('uuid')) then
|
||||
g_settings:set('uuid', g_crypt.getMachineUUID())
|
||||
g_settings:save()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,9 +101,9 @@ function terminate()
|
||||
disconnect(g_app, { onRun = startup,
|
||||
onExit = exit })
|
||||
-- save window configs
|
||||
g_settings.set('window-size', g_window.getUnmaximizedSize())
|
||||
g_settings.set('window-pos', g_window.getUnmaximizedPos())
|
||||
g_settings.set('window-maximized', g_window.isMaximized())
|
||||
g_settings:set('window-size', g_window.getUnmaximizedSize())
|
||||
g_settings:set('window-pos', g_window.getUnmaximizedPos())
|
||||
g_settings:set('window-maximized', g_window.isMaximized())
|
||||
end
|
||||
|
||||
function exit()
|
||||
|
Reference in New Issue
Block a user