allow the window to be resized

This still isn't ideal. On my Linux laptop for some reason the window
receives a signal to maximize itself soon after (but sometime after) the
program starts.
This commit is contained in:
Kartik K. Agaram 2022-06-07 13:19:17 -07:00
parent bc46cef4e5
commit 33ea91f8d9
1 changed files with 13 additions and 2 deletions

View File

@ -87,11 +87,14 @@ function App.initialize(arg)
-- maximize window
love.window.setMode(0, 0) -- maximize
App.screen.width, App.screen.height = love.window.getMode()
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
love.window.setMode(App.screen.width, App.screen.height)
App.screen.flags.resizable = true
App.screen.flags.minwidth = math.min(App.screen.width, 200)
App.screen.flags.minheight = math.min(App.screen.width, 200)
love.window.updateMode(App.screen.width, App.screen.height, App.screen.flags)
initialize_font_settings(20)
@ -110,6 +113,14 @@ function App.initialize(arg)
end -- App.initialize
function love.resize(w, h)
--? print(("Window resized to width: %d and height: %d."):format(w, h))
App.screen.width, App.screen.height = w, h
Line_width = math.min(40*App.width(Em), App.screen.width-50)
-- Should I Text.redraw_all() here to reset text fragments? It doesn't seem
-- to be needed, based on repeatedly resizing the window up and down.
end
function initialize_font_settings(font_height)
Font_height = font_height
love.graphics.setFont(love.graphics.newFont(Font_height))