bugfix: on.load_settings when there are none
Attempt #2; commit bbe8925378
was stupid and useless.
Scenario: run driver without any saved settings.
Before this commit (in driver repo), the driver would crash on quit.
This commit is contained in:
parent
427285216a
commit
29479aa5a1
1
0001-on
1
0001-on
|
@ -16,5 +16,6 @@ on = {
|
|||
-- 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
|
||||
-- settings might be nil if there are no saved settings
|
||||
-- on.save_settings() -- return a settings table which will be persisted to disk across restart
|
||||
}
|
||||
|
|
3
main.lua
3
main.lua
|
@ -78,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))
|
||||
|
@ -91,8 +92,8 @@ function load_settings()
|
|||
App.screen.flags.minwidth = math.min(App.screen.width, 200)
|
||||
App.screen.flags.minheight = math.min(App.screen.height, 200)
|
||||
love.window.setMode(App.screen.width, App.screen.height, App.screen.flags)
|
||||
if on.load_settings then on.load_settings() end
|
||||
end
|
||||
if on.load_settings then on.load_settings(settings.app) end
|
||||
end
|
||||
|
||||
function App.resize(w, h)
|
||||
|
|
Loading…
Reference in New Issue