2011-11-03 10:59:11 +01:00
|
|
|
Options = {}
|
|
|
|
|
2012-01-06 09:48:59 +01:00
|
|
|
function Options.load()
|
2012-01-06 10:10:55 +01:00
|
|
|
local booleanOptions = { vsync = true,
|
|
|
|
showfps = true,
|
|
|
|
fullscreen = false }
|
2012-01-06 09:48:59 +01:00
|
|
|
|
2012-01-06 10:10:55 +01:00
|
|
|
for k,v in pairs(booleanOptions) do
|
|
|
|
Settings.setDefault(k, v)
|
|
|
|
Options.changeOption(k, Settings.getBoolean(k))
|
|
|
|
end
|
2012-01-06 09:48:59 +01:00
|
|
|
end
|
2011-11-17 01:12:11 +01:00
|
|
|
|
2012-01-06 09:48:59 +01:00
|
|
|
function Options.show()
|
|
|
|
displayUI('options.otui', { locked = true })
|
2011-11-17 01:12:11 +01:00
|
|
|
end
|
|
|
|
|
2012-01-06 09:48:59 +01:00
|
|
|
function Options.openWebpage()
|
|
|
|
displayErrorBox("Error", "Not implemented yet")
|
2011-11-17 01:12:11 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
-- private functions
|
2012-01-06 10:10:55 +01:00
|
|
|
function Options.changeOption(key, status)
|
|
|
|
if key == 'vsync' then
|
|
|
|
g_window.setVerticalSync(status)
|
|
|
|
elseif key == 'showfps' then
|
2012-01-07 01:18:08 +01:00
|
|
|
addEvent(function()
|
|
|
|
local frameCounter = rootWidget:recursiveGetChildById('frameCounter')
|
|
|
|
if frameCounter then frameCounter:setVisible(status) end
|
|
|
|
end)
|
2012-01-06 10:10:55 +01:00
|
|
|
elseif key == 'fullscreen' then
|
2012-01-07 01:18:08 +01:00
|
|
|
addEvent(function()
|
|
|
|
g_window.setFullscreen(status)
|
|
|
|
end)
|
2012-01-06 10:10:55 +01:00
|
|
|
end
|
|
|
|
Settings.set(key, status)
|
|
|
|
Options[key] = status
|
2011-11-03 10:59:11 +01:00
|
|
|
end
|