PDA

View Full Version : glut mouse coordinates



eisebs
04-07-2003, 01:00 PM
Hello Everyone!

I have a short question on mouse beaviour in glut. I want to have a rolling ball in my game that the user can control directly by mouse movement like in the atari st game oxyd. Now my problem is that when I hide the mouse, there's still the screen bounderies, meaning that I can only detect mouse movement _within_ the screen or window.
Is it somehow possible in glut to get relative mouse coordinates or to set the mouse coordinates back to the center abter reading them?
And if it isn't, could I do it via DirectInput?

thanks a lot in advance

Robin

Gavin
04-07-2003, 01:31 PM
Have a search on this list as this has been answered before... but I can't remember what the answer is!

eisebs
04-07-2003, 01:49 PM
Thanks, I found it!
I used glutWarpPointer and after a few problems it works just fine.
great discussion board!

jebus
04-08-2003, 05:28 AM
one handy technique is to, at the start of your application, turn off the cursor and move the mouse to the center of your scene. then, each frame, find out how much the mouse moved, then move it back to the center. great for time-based input, and you never have to deal with the window boundaries.

jebus

eisebs
04-08-2003, 06:07 AM
That was my first approach.
When it turned out to be a bit troublesome I let the mouse move and only move it back if it comes too close to the boundaries.
But maybe I'll change it back again. I found the error and now it should also work the way you described. Seems to be easier and also the common way.
(When you press Alt+Tab while playing Counterstrike and then go back to the game you can sometimes see the mouse cursor flickering around the center of the screen.)

greetz
robin