Is there a way in Love2D to determine which side of a window is being resized?

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
SugarRayLua
Citizen
Posts: 54
Joined: Sat Dec 03, 2022 7:52 pm

Is there a way in Love2D to determine which side of a window is being resized?

Post by SugarRayLua »

In our MiniIDE project, I'm experimenting with getting the editor (its own window) inside the Love2D window to move in relationship to the Love2D window resizing. However, it seems to do that properly, I need to determine which side of the Love2D window is shrinking (e.g. if the editor window is anchored on the right-side of the Love2D window and the user moves the left side of the Love2D window inwards then the editor window can stay put. If, instead, the user moves the right side of the Love2D window inwards, I need to know that in order to translate the editor window to the left).

Is there a way, therefore, in Love2D to determine which side of the Love2D window is being resized?

I appreciate any input the community might have.

Thanks! 😊
User avatar
marclurr
Party member
Posts: 105
Joined: Fri Apr 22, 2022 9:25 am

Re: Is there a way in Love2D to determine which side of a window is being resized?

Post by marclurr »

I haven't checked but I would imagine the window position would also change when it's resized from the left. Maybe you can use that to help your logic?
User avatar
Bobble68
Party member
Posts: 160
Joined: Wed Nov 30, 2022 9:16 pm
Contact:

Re: Is there a way in Love2D to determine which side of a window is being resized?

Post by Bobble68 »

marclurr wrote: Sun Dec 03, 2023 7:37 am I haven't checked but I would imagine the window position would also change when it's resized from the left. Maybe you can use that to help your logic?
I imagine this would work, but you might have some trouble using this alone if you're just moving the window without resizing it - you might want to also check if the window size has changed if the position of the window has changed.
Dragon
User avatar
marclurr
Party member
Posts: 105
Joined: Fri Apr 22, 2022 9:25 am

Re: Is there a way in Love2D to determine which side of a window is being resized?

Post by marclurr »

Yeah, if it wasn't clear, I was suggesting to use the position when handling the resize event. It wouldn't work without both pieces of information.
SugarRayLua
Citizen
Posts: 54
Joined: Sat Dec 03, 2022 7:52 pm

Re: Is there a way in Love2D to determine which side of a window is being resized?

Post by SugarRayLua »

Ingenious solution, thank you, all! 😊
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 50 guests