rip out geometry commandline arg
[?]
Jul 1, 2022, 5:02 AM
HFI2YR2CWHWTAIQMDM6HIHHBUKQ74WA2QXW72PSKZWKHSVFWLKSQCDependencies
- [2]
46ASCE5Kfirst commandline arg: window dimensions - [3]
AD34IX2Zcouple more tests - [4]
73OCE2MCafter much struggle, a brute-force undo - [5]
AVQ5MC5Dfinish uppercasing all globals - [6]
XSLCFVFH. - [7]
AJB4LFRBtry to maintain a reasonable line width - [8]
Z4KNS42Nto open a file without a terminal, drag it on! - [9]
OTIBCAUJlove2d scaffold - [10]
NEXUNNCFextract a function - [11]
AVTNUQYRbasic test-enabled framework
Change contents
- replacement in main.lua at line 105
if arg[1] == '-geometry' theninitialize_window_geometry(arg[2])table.remove(arg, 2)table.remove(arg, 1)elseinitialize_window_geometry()endinitialize_window_geometry() - replacement in main.lua at line 133
function initialize_window_geometry(geometry_spec)local geometry_initializedif geometry_spec thengeometry_initialized = parse_geometry_spec(geometry_spec)endif not geometry_initialized then-- maximize windowlove.window.setMode(0, 0) -- maximizeApp.screen.width, App.screen.height, App.screen.flags = love.window.getMode()-- shrink slightly to account for window decorationApp.screen.width = App.screen.width-100App.screen.height = App.screen.height-100endfunction initialize_window_geometry()-- maximize windowlove.window.setMode(0, 0) -- maximizeApp.screen.width, App.screen.height, App.screen.flags = love.window.getMode()-- shrink slightly to account for window decorationApp.screen.width = App.screen.width-100App.screen.height = App.screen.height-100 - edit in main.lua at line 144
endfunction parse_geometry_spec(geometry_spec)local width, height, x, y = geometry_spec:match('(%d+)x(%d+)%+(%d+)%+(%d+)')if width == nil thenprint('invalid geometry spec: '..geometry_spec)print('expected format: {width}x{height}+{x}+{y}')return falseendApp.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