get_mouse_mickeys() alternative for windowed modes
Paul whoknows

I am using get_mouse_mickeys() a lot in my game, and it works fine in non-windowed modes, but as the documentation says

TFM said:

Note that the infinite movement may not work in windowed mode, since under some platforms the mouse would leave the window, and may not work at all if the hardware cursor is in use.

How can I replace this function for windowed modes?
I want my game running in both: fullscreen and windowed modes!

CGamesPlay

I just use:position_mouse(SCREEN_W / 2, SCREEN_H / 2)

Paul whoknows

It seems that I was not clear enough.
As we all already know, get_mouse_mickeys() measures how far the mouse has moved since the last call to this function, that's exactly what I need to achieve without using this function(because it doesn't work in windowed modes)

Quote:

position_mouse(SCREEN_W / 2, SCREEN_H / 2)

You are positioning the mouse at the center of the screen, that's not what I want.

Thomas Fjellstrom

get_mouse_mickeys will still function if you keep repositioning the mouse in the center.

CGamesPlay

If you position the mouse in the center of the screen, get_mouse_mickeys will work, because the user cannot move the mouse outside of the screen.

ImLeftFooted

Except on OSX. Or has position_mouse been fixed for that yet?

I actually use delta mouse movement (ie storing the old position and comparing the difference). But I also want the mouse to be able to leave via the bottom in windowed mode. So mickies dont work.

And also most OSs have 'lock the mouse to my window' API calls, allegro should really make that available.

Paul whoknows

I am slow:P, but now I got it!
However I think that will raise another problems, (I am also using mouse_x, and mouse_y), I'll try it now!
Thanks!

EDIT

Quote:

And also most OSs have 'lock the mouse to my window' API calls

Which Windows specific functions should I use to do that?

Evert
Quote:

How can I replace this function for windowed modes?

You can't, in a portable way.

Paul whoknows
Quote:

And also most OSs have 'lock the mouse to my window' API calls, allegro should really make that available.

Which Windows specific functions should I use to do that?

CGamesPlay
Quote:

Which Windows specific functions should I use to do that?

Well, position_mouse works fine, and it works in Linux, too.

Richard Phipps

Yes, position_mouse works well.

Thread #590051. Printed from Allegro.cc