Page 1 of 1

How to: resizing and the maximize button?

Posted: Sat Sep 01, 2018 6:47 am
by xThomas
so here is my resizing code. When you hit the maximize button, well, it goes kind of slow as it changes the window size and doesn't look that good. How can I improve this?

Code: Select all

window_state = 1
function love.resize(w,h)
if window_state == 1 then
    love.window.updateMode(800,600,{fullscreen = false, resizable = true, highdpi = true})
    window_state = 2
elseif window_state == 2 then
    love.window.updateMode( 1024, 768, {fullscreen = false, resizable = true, highdpi = true} )
    window_state = 3
else
    love.window.updateMode( 640, 480, {fullscreen = false, resizable = true, highdpi = true} )
    window_state = 1
end

end

Re: How to: resizing and the maximize button?

Posted: Sat Sep 01, 2018 7:48 am
by zorg
Seems needlessly complicated, and also the dimensions are hard-coded so it won't work for anyone else but you.

Do use love.window.getMode instead of your own variable, and love.window.getDesktopDimensions to query the current screen's resolution to maximize the window. (The current screen index will be returned by getMode)

All of this only applies if love.window.maximize doesn't work for you, of course.