create space for app-specific settings

This commit is contained in:
Kartik K. Agaram 2023-01-01 18:22:52 -08:00
parent 998e40894f
commit 9a0b1871d6
2 changed files with 4 additions and 0 deletions

View File

@ -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
}

View File

@ -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))