Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » get_mouse_mickeys(...)

This thread is locked; no one can reply to it. rss feed Print
get_mouse_mickeys(...)
adamk kromm
Member #5,432
January 2005

what is the difference between

int xoff, yoff;

get_mouse_mickeys(&xoff, &yoff);

and

int oldx, oldy;
int xoff, yoff;
xoff = (mouse_x - oldx);
yoff = (mouse_y - oldy);
oldx = mouse_x;
oldy = mouse_y;

i ask cause the second way works how i want/expect but the mouse mickeys dont work how i want/expect.

----------
-Adam Kromm

My Website

gnolam
Member #2,030
March 2002
avatar

Try putting a position_mouse(SCREEN_W/2, SCREEN_H/2) in there and you'll see a big difference. Or try moving the mouse past edge of the screen.

Quote:

i ask cause the second way works how i want/expect but the mouse mickeys dont work how i want/expect

And how do you expect them to work?

And for God's sake, use some capitalization. The shift key on your keyboard isn't just decorative.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

adamk kromm
Member #5,432
January 2005

I'm using it to rotate a camera in a OpenGL program.

The second way the camera rotates fine, but the first way, the camera will move a few degrees then go back to where it started.

EDIT:: nvm I found the error was in another part of my code. And that the two above work the same. ;)

----------
-Adam Kromm

My Website

Evert
Member #794
November 2000
avatar

They don't work the same cross platform. Not all platforms allow mose events once the mouse leaves the window (or hits the edge of the screen) - in which case mouse_x/y will no longer be updated but get_mouse_mickeys() will do something clever to fake continuous mouse movement.

kazzmir
Member #1,786
December 2001
avatar

I cant seem to keep the mouse inside the screen on osx. Regardless of where I put position_mouse(320,240)( before or after get_mouse_mickeys ), the x,y output from get_mouse_mickeys is always 0. Any ideas? Allegro 4.2.1.

Go to: