create space for app-specific settings
This commit is contained in:
parent
998e40894f
commit
9a0b1871d6
2
0001-on
2
0001-on
|
@ -15,4 +15,6 @@ on = {
|
|||
-- on.keychord_press (see keychord.lua in this repo)
|
||||
-- on.text_input (see love.textinput)
|
||||
-- on.key_release (see love.keyreleased)
|
||||
-- on.load_settings(settings) -- fan out settings table into any other global state
|
||||
-- on.save_settings() -- return a settings table which will be persisted to disk across restart
|
||||
}
|
||||
|
|
2
main.lua
2
main.lua
|
@ -62,6 +62,7 @@ function settings()
|
|||
return {
|
||||
x=x, y=y, displayindex=displayindex,
|
||||
width=App.screen.width, height=App.screen.height,
|
||||
app = on.save_settings and on.save_settings(),
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -77,6 +78,7 @@ function load_settings()
|
|||
App.screen.height = settings.height
|
||||
love.window.setMode(App.screen.width, App.screen.height, App.screen.flags)
|
||||
love.window.setPosition(settings.x, settings.y, settings.displayindex)
|
||||
if on.load_settings then on.load_settings(settings.app) end
|
||||
else
|
||||
local font_height = 20
|
||||
love.graphics.setFont(love.graphics.newFont(font_height))
|
||||
|
|
Loading…
Reference in New Issue