persist window geometry to disk across restart

[?]
Jan 2, 2023, 2:19 AM
DSDKFEUKSAWZGMJ4PISC64WVYVSEHWAOJ5WE7K7PJAY5G3UGV36QC

Dependencies

  • [2] MPETAKZ2 insert space for loading settings
  • [3] LF3FPBGA move
  • [4] 36Z442IV back to commit 8123959e52f without code editing
  • [5] YT5P6TO6 bugfix: save previous file when dropping a new one on
  • [*] OTIBCAUJ love2d scaffold

Change contents

  • replacement in main.lua at line 57
    [3.65][3.65:90]()
    -- TODO: save settings
    [3.65]
    [4.3079]
    love.filesystem.write('config', json.encode(settings()))
    end
    function settings()
    local x, y, displayindex = App.screen.position()
    return {
    x=x, y=y, displayindex=displayindex,
    width=App.screen.width, height=App.screen.height,
    }
  • edit in main.lua at line 70
    [2.51]
    [2.51]
    local settings = json.decode(love.filesystem.read('config'))
    local width, height, flags = love.window.getMode()
    flags.resizable = true
    flags.minwidth = math.min(width, 200)
    flags.minheight = math.min(height, 200)
    App.screen.flags = flags
    App.screen.width = settings.width
    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)