zorg wrote:Kingdaro wrote:In theory, the display shouldn't need to be saved as a variable, for reasons I couldn't really explain.
You're right in that you could just get the current display and use that in your window shake function, but that still might move the window outside of one display, meaning wrapping will occur, and the window will appear on the opposite side of the screen (happens now as well)
This really can't be solved imo without getting the desktop coordinates of the window, though there may be ways i haven't considered...
I'm not sure. I think it really works either way, though. I thought of this example in the time I worked on other things.
Let's say, for all intents and purposes and for easy math, that the monitor width is 2000, and there's another monitor beside that with the same width. Then we'll say that the window is at x 1995, and the screenshake would put it at x 2005 on the next frame, so the WindowShake module says "alright, we're currently at display 1, so we'll go to x 2005 using display 1".
There are two things that could happen here. The first being that it'll loop to the second window, in which case, the second display will be used on the next frame. The second being that it's still registered as being on display 1 at that position, which is unlikely, but should still work all the same.
The module already accounts for the user moving the window (by using two separate coordinate variables, window(X/Y) to keep track of the "base" window position, and offset(X/Y) for how much to change it the next frame), so either way, just checking the display on the current frame should
in theory work out fine. If there's anything wrong with my logic, let me know.
bobbyjones wrote:on my machine it works wonderfully except that it moved quite a bit to right from the original position. My os is ubuntu if it makes a difference.
Huh. I'm not sure what would cause that, other than perhaps ignored calls to love.window.setPosition()? Last I checked, there wasn't a way to see if the call successfully went through, but I guess that's why it's good to just make it an option, then.