# Thread: Is there a way to get mickeys in GLUT?

1. ## Is there a way to get mickeys in GLUT?

I'm trying to convert code from DirectInput to GLUT, so that I can run it on Windows NT. But as far as I can tell, GLUT only supports screen coordinates, not mickeys. This is all fine and dandy, because I can just keep track of the last X and Y coordinates, and do a difference. But, I need a way to reset the X and Y coordinates. Otherwise, a user could move the mouse to the edge of the screen, and then the mouse would just seem to stop working.

Note, I'm not using the mouse like a cursor, I'm using it for rotating cameras, so it needs to be infinite in scope, i.e. not confined to a window. I need to be able to scroll it in any direction indefinitely. Can this be done with GLUT?

2. ## Re: Is there a way to get mickeys in GLUT?

you can use glutSetCursor(GLUT_CURSOR_NONE) to make the cursor invisible. glutWarpPointer(x,y) will move the cursor to the window coordinate specified. for good infinite mouse movement, use time based input. start out moving the cursor to the center of the window, then every frame, calc how far the cursor moved in x and y directions, then move the cursor back to the center of the screen.

b

BTW: what in the he!! is a mickey?!?

3. ## Re: Is there a way to get mickeys in GLUT?

Originally posted by coredump:

BTW: what in the he!! is a mickey?!?
If you programmed IBM-compatible PCs 10-15 years ago, this is the documentation you came to know and love: Ralph Brown's interrupt list.
INT 33 - MS MOUSE v1.0+ - READ MOTION COUNTERS
AX = 000Bh
Return: CX = number of mickeys mouse moved horizontally since last call
DX = number of mickeys mouse moved vertically
Notes: a mickey is the smallest increment the mouse can sense
positive values indicate down/right
SeeAlso: AX=0003h,AX=001Bh,AX=0027h

For the new generation of kids - from the Microsoft Visual Studios 6 documentation:
Remember, GetDeviceState does not report the position of the cursor relative to either the screen or the window; it reports the travel of the mouse (in "mickeys," a mickey being the smallest movement of the mouse that can be recorded). In other words, if the cursor reaches the edge of the screen but the user keeps pushing the mouse in that direction, the axis values reported by GetDeviceState keep changing. If the user has mouse acceleration turned on, moving the Windows cursor a given distance may take more or fewer mickeys, depending on when acceleration kicks in.

Anyway, thanks for the info. That sounded like exactly what I was looking for.

4. ## Re: Is there a way to get mickeys in GLUT?

for a moment i thought you wanted to draw mickey mouse using a single glut function... (like a teapot)
You can easly simulate this behaviour by storing the last mouse position an substracting the current. Voila, the needed relative mouse position.

MtPOI

5. ## Re: Is there a way to get mickeys in GLUT?

Originally posted by masterpoi:
for a moment i thought you wanted to draw mickey mouse using a single glut function... (like a teapot)
You can easly simulate this behaviour by storing the last mouse position an substracting the current. Voila, the needed relative mouse position.

MtPOI

Yes, but what happens when the mouse hits the edge of the screen? Have you ever played one of those GLUT-based games where you can only turn so far in each direction?

Imagine Quake where you can only turn 360 degrees, and you have to turn back 350 degrees to the right just to turn 10 degrees to the left. And what about when someone finds this "weak spot"/direction, and tries to stay in the area so that you constantly have to whip around back and forth just to shoot at someone who takes one step to the left and one to the right over and over.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•