What is the difference between love.resize and love.window.updateMode?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

What is the difference between love.resize and love.window.updateMode?

Post by ddabrahim »

Hi everyone!

Could someone please tell me what is the difference internally between the callback method love.resize and love.window.updateMode?

The problem is that when I update some values and then call updateMode to change window size, a canvas is no longer drawn on the screen. Everything else is fine except this one canvas is no longer drawn. If I debug it, the position, size, draw order, transparency, everything is fine yet not drawn on the screen.
But when I update the same values inside love.resize, everything is fine and the canvas is drawn with the updated values whenever I resize the window. But this is not what I would like to ask for help with, instead I would like to understand what is the difference between resizing a window and love.resize and calling updateMode so then maybe I can fix this myself.

I would appreciate if someone could explain it.

Thank you.
Ross
Party member
Posts: 100
Joined: Tue Mar 13, 2018 12:12 pm
Contact:

Re: What is the difference between love.resize and love.window.updateMode?

Post by Ross »

This seems like comparing apples to worms to me, the two things are barely even related at all.

love.resize is one of the main engine callbacks, like love.load, love,update, love.draw, etc., that Löve calls for you, in this case, when the window is resized. You may fill out the contents of the function if you want, otherwise it does nothing.

love.window.updateMode is a function that you call yourself, when you want to change some properties of the window without changing properties that you don't specify (as opposed to .setMode that overrides all of them).

Actually, I expected love.resize to get called after you call love.window.updateMode, but that is not the case.

If you look at the docs for love.window.updateMode, it says that "canvases will be cleared". Maybe this is why it is not visible in your case?
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: What is the difference between love.resize and love.window.updateMode?

Post by ddabrahim »

This seems like comparing apples to worms to me, the two things are barely even related at all.
Well, they are not related but what I was thinking is that when I resize the window it works, but when I change the size of the window it doesn't.

Thanks a lot for the explanation. I did not pay attention to that updateMode did actually mentioned canvases are cleared :P
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests