rip out geometry commandline arg

[?]
Jul 1, 2022, 5:02 AM
HFI2YR2CWHWTAIQMDM6HIHHBUKQ74WA2QXW72PSKZWKHSVFWLKSQC

Dependencies

  • [2] 46ASCE5K first commandline arg: window dimensions
  • [3] AD34IX2Z couple more tests
  • [4] 73OCE2MC after much struggle, a brute-force undo
  • [5] AVQ5MC5D finish uppercasing all globals
  • [6] XSLCFVFH .
  • [7] AJB4LFRB try to maintain a reasonable line width
  • [8] Z4KNS42N to open a file without a terminal, drag it on!
  • [9] OTIBCAUJ love2d scaffold
  • [10] NEXUNNCF extract a function
  • [11] AVTNUQYR basic test-enabled framework

Change contents

  • replacement in main.lua at line 105
    [3.1738][2.8:175]()
    if arg[1] == '-geometry' then
    initialize_window_geometry(arg[2])
    table.remove(arg, 2)
    table.remove(arg, 1)
    else
    initialize_window_geometry()
    end
    [3.1738]
    [3.47]
    initialize_window_geometry()
  • replacement in main.lua at line 133
    [3.1320][2.176:683]()
    function initialize_window_geometry(geometry_spec)
    local geometry_initialized
    if geometry_spec then
    geometry_initialized = parse_geometry_spec(geometry_spec)
    end
    if not geometry_initialized then
    -- maximize window
    love.window.setMode(0, 0) -- maximize
    App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
    -- shrink slightly to account for window decoration
    App.screen.width = App.screen.width-100
    App.screen.height = App.screen.height-100
    end
    [3.1320]
    [3.384]
    function initialize_window_geometry()
    -- maximize window
    love.window.setMode(0, 0) -- maximize
    App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
    -- shrink slightly to account for window decoration
    App.screen.width = App.screen.width-100
    App.screen.height = App.screen.height-100
  • edit in main.lua at line 144
    [3.625][2.684:1155]()
    end
    function parse_geometry_spec(geometry_spec)
    local width, height, x, y = geometry_spec:match('(%d+)x(%d+)%+(%d+)%+(%d+)')
    if width == nil then
    print('invalid geometry spec: '..geometry_spec)
    print('expected format: {width}x{height}+{x}+{y}')
    return false
    end
    App.screen.width = math.floor(tonumber(width))
    App.screen.height = math.floor(tonumber(height))
    App.screen.flags = {x=math.floor(tonumber(x)), y=math.floor(tonumber(y))}
    return true