1 /*         ______   ___    ___
2  *        /\  _  \ /\_ \  /\_ \
3  *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
4  *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
5  *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
6  *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7  *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8  *                                           /\____/
9  *                                           \_/__/
10  *
11  *      Mouse routines.
12  *
13  *      By Shawn Hargreaves.
14  *
15  *      See readme.txt for copyright information.
16  */
17 
18 
19 #ifndef ALLEGRO_MOUSE_H
20 #define ALLEGRO_MOUSE_H
21 
22 #include "base.h"
23 
24 #ifdef __cplusplus
25    extern "C" {
26 #endif
27 
28 #define MOUSEDRV_AUTODETECT  -1
29 #define MOUSEDRV_NONE         0
30 
31 
32 typedef struct MOUSE_DRIVER
33 {
34    int  id;
35    AL_CONST char *name;
36    AL_CONST char *desc;
37    AL_CONST char *ascii_name;
38    AL_METHOD(int,  init, (void));
39    AL_METHOD(void, exit, (void));
40    AL_METHOD(void, poll, (void));
41    AL_METHOD(void, timer_poll, (void));
42    AL_METHOD(void, position, (int x, int y));
43    AL_METHOD(void, set_range, (int x1, int y_1, int x2, int y2));
44    AL_METHOD(void, set_speed, (int xspeed, int yspeed));
45    AL_METHOD(void, get_mickeys, (int *mickeyx, int *mickeyy));
46    AL_METHOD(int,  analyse_data, (AL_CONST char *buffer, int size));
47    AL_METHOD(void, enable_hardware_cursor, (int mode));
48    AL_METHOD(int,  select_system_cursor, (int cursor));
49 } MOUSE_DRIVER;
50 
51 
52 AL_VAR(MOUSE_DRIVER, mousedrv_none);
53 AL_VAR(MOUSE_DRIVER *, mouse_driver);
54 AL_ARRAY(_DRIVER_INFO, _mouse_driver_list);
55 
56 AL_FUNC(int, install_mouse, (void));
57 AL_FUNC(void, remove_mouse, (void));
58 
59 AL_FUNC(int, poll_mouse, (void));
60 AL_FUNC(int, mouse_needs_poll, (void));
61 
62 AL_FUNC(void, enable_hardware_cursor, (void));
63 AL_FUNC(void, disable_hardware_cursor, (void));
64 
65 /* Mouse cursors */
66 #define MOUSE_CURSOR_NONE        0
67 #define MOUSE_CURSOR_ALLEGRO     1
68 #define MOUSE_CURSOR_ARROW       2
69 #define MOUSE_CURSOR_BUSY        3
70 #define MOUSE_CURSOR_QUESTION    4
71 #define MOUSE_CURSOR_EDIT        5
72 #define AL_NUM_MOUSE_CURSORS        6
73 
74 AL_VAR(struct BITMAP *, mouse_sprite);
75 AL_VAR(int, mouse_x_focus);
76 AL_VAR(int, mouse_y_focus);
77 
78 AL_VAR(volatile int, mouse_x);
79 AL_VAR(volatile int, mouse_y);
80 AL_VAR(volatile int, mouse_z);
81 AL_VAR(volatile int, mouse_w);
82 AL_VAR(volatile int, mouse_b);
83 AL_VAR(volatile int, mouse_pos);
84 
85 AL_VAR(volatile int, freeze_mouse_flag);
86 
87 #define MOUSE_FLAG_MOVE             1
88 #define MOUSE_FLAG_LEFT_DOWN        2
89 #define MOUSE_FLAG_LEFT_UP          4
90 #define MOUSE_FLAG_RIGHT_DOWN       8
91 #define MOUSE_FLAG_RIGHT_UP         16
92 #define MOUSE_FLAG_MIDDLE_DOWN      32
93 #define MOUSE_FLAG_MIDDLE_UP        64
94 #define MOUSE_FLAG_MOVE_Z           128
95 #define MOUSE_FLAG_MOVE_W           256
96 
97 AL_FUNCPTR(void, mouse_callback, (int flags));
98 
99 AL_FUNC(void, show_mouse, (struct BITMAP *bmp));
100 AL_FUNC(void, scare_mouse, (void));
101 AL_FUNC(void, scare_mouse_area, (int x, int y, int w, int h));
102 AL_FUNC(void, unscare_mouse, (void));
103 AL_FUNC(void, position_mouse, (int x, int y));
104 AL_FUNC(void, position_mouse_z, (int z));
105 AL_FUNC(void, position_mouse_w, (int w));
106 AL_FUNC(void, set_mouse_range, (int x1, int y_1, int x2, int y2));
107 AL_FUNC(void, set_mouse_speed, (int xspeed, int yspeed));
108 AL_FUNC(void, select_mouse_cursor, (int cursor));
109 AL_FUNC(void, set_mouse_cursor_bitmap, (int cursor, struct BITMAP *bmp));
110 AL_FUNC(void, set_mouse_sprite_focus, (int x, int y));
111 AL_FUNC(void, get_mouse_mickeys, (int *mickeyx, int *mickeyy));
112 AL_FUNC(void, set_mouse_sprite, (struct BITMAP *sprite));
113 AL_FUNC(int, show_os_cursor, (int cursor));
114 AL_FUNC(int, mouse_on_screen, (void));
115 
116 #ifdef __cplusplus
117    }
118 #endif
119 
120 #endif          /* ifndef ALLEGRO_MOUSE_H */
121 
122 
123