After clamping my block to the left/right world units, I was playing with bouncing the ball and noticed an issue. If my mouse cursor is at the level of the brick, give or take a few world units, it works as expected. But if my mouse is halfway up the game screen, and exits to the left, the paddle will suddenly jump to the right of the screen.
On investigating, it seems that when the mouse cursor is out of the game area, it’s wrapping the X count. Just to the left of the zero position, it starts reporting a much higher number (622 in my current test) and counting down as you move the cursor left.
I get that this is outside of the game space, and I know there are other methods for tracking relative mouse movement rather than asking for the position. However, what I want to know is why I’m seeing this behaviour. First off, I would expect that if you went off the left of the screen it would stay at zero. Second, I would expect the behaviour to be consistent across the y-space. What’s going on here?
Here’s an animation of what I’m seeing: http://giphy.com/gifs/3o7TKCLYBJWglHNa9y