Calculate mouse movement without mouse position?
Posted: Tue Feb 19, 2013 3:10 pm
Hi,
I'm trying to put object on a map by dragging them on a map.
The problem is, when I go away from the game window borders, it stops moving.
So I thought about calculating coordinates based on mouse movement.
But once the mouse cursor has arrived on the edge of the screen I'm stuck since coordinates stay the same even if I "move" the mouse.
Any way of calculating mouse movement without using mouse position? I mean since the cursor ends in the corner of the screen, its position doesn't change so I must find a way to calculate the movement anyway if the user tries to position something on the map. (The cursor is invisible, and setGrab = true)
This happen right now because the game's gridsize is 48 and I move object by 24 to make more possibilities of placement. So the mouse gets to half of the screen and then stops since the cursor is on the screen's edge.
I don't know if I explain this clearly, any questions are welcome.
EDIT: I could try to calculate mouse acceleration and use this to move faster/slower in the game window (while placing object only), any idea about mouse acceleration?
Thanks!
I'm trying to put object on a map by dragging them on a map.
The problem is, when I go away from the game window borders, it stops moving.
So I thought about calculating coordinates based on mouse movement.
But once the mouse cursor has arrived on the edge of the screen I'm stuck since coordinates stay the same even if I "move" the mouse.
Any way of calculating mouse movement without using mouse position? I mean since the cursor ends in the corner of the screen, its position doesn't change so I must find a way to calculate the movement anyway if the user tries to position something on the map. (The cursor is invisible, and setGrab = true)
This happen right now because the game's gridsize is 48 and I move object by 24 to make more possibilities of placement. So the mouse gets to half of the screen and then stops since the cursor is on the screen's edge.
I don't know if I explain this clearly, any questions are welcome.
EDIT: I could try to calculate mouse acceleration and use this to move faster/slower in the game window (while placing object only), any idea about mouse acceleration?
Thanks!