How to: resizing and the maximize button?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
xThomas
Prole
Posts: 16
Joined: Tue May 02, 2017 2:43 am

How to: resizing and the maximize button?

Post 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
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to: resizing and the maximize button?

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests