Page 1 of 1
Is there a way in Love2D to determine which side of a window is being resized?
Posted: Sun Dec 03, 2023 5:55 am
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!
Re: Is there a way in Love2D to determine which side of a window is being resized?
Posted: Sun Dec 03, 2023 7:37 am
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?
Re: Is there a way in Love2D to determine which side of a window is being resized?
Posted: Sun Dec 03, 2023 11:42 am
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.
Re: Is there a way in Love2D to determine which side of a window is being resized?
Posted: Sun Dec 03, 2023 12:53 pm
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.
Re: Is there a way in Love2D to determine which side of a window is being resized?
Posted: Mon Dec 04, 2023 6:15 pm
by SugarRayLua
Ingenious solution, thank you, all!