1al_get_mouse_state(3) al_get_mouse_state(3)
2
3
4
6 al_get_mouse_state - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 void al_get_mouse_state(ALLEGRO_MOUSE_STATE *ret_state)
12
14 Save the state of the mouse specified at the time the function is
15 called into the given structure.
16
17 Example:
18
19 ALLEGRO_MOUSE_STATE state;
20
21 al_get_mouse_state(&state);
22 if (state.buttons & 1) {
23 /* Primary (e.g. left) mouse button is held. */
24 printf("Mouse position: (%d, %d)\n", state.x, state.y);
25 }
26 if (state.buttons & 2) {
27 /* Secondary (e.g. right) mouse button is held. */
28 }
29 if (state.buttons & 4) {
30 /* Tertiary (e.g. middle) mouse button is held. */
31 }
32
34 ALLEGRO_MOUSE_STATE(3), al_get_mouse_state_axis(3), al_mouse_but‐
35 ton_down(3)
36
37
38
39Allegro reference manual al_get_mouse_state(3)