Re: [AD] Is al_set_mouse_range any useful? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] Is al_set_mouse_range any useful?
- From: Trent Gamblin <trentg@xxxxxxxxxx>
- Date: Mon, 08 Oct 2007 17:40:10 -0600
Evert Glebbeek wrote:
But, to me, this is very vague (I never actually used the function
so I
don't know how it works). Does it mean, the mouse cursor stops
moving at
the given coordinates?
Yes.
That may be the way it's supposed to work, but it doesn't for me, at
least on Windows in windowed mode. All that happens is the coordinates
reported by mouse_x/y are clipped to the range you specify.
Here's the program I used:
--
#include <allegro.h>
int main(void)
{
allegro_init();
install_keyboard();
install_mouse();
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0);
show_mouse(screen);
set_mouse_range(50, 50, 300, 300);
position_mouse(100, 100);
while (!keypressed()) {
printf("mouse_x=%d mouse_y=%d\n", mouse_x, mouse_y);
}
}
END_OF_MAIN()