annotate src/events/SDL_mouse_c.h @ 3771:8cc36a399a12 gsoc2008_manymouse

comments added and improved code look(windows part)
author Szymon Wilczek <kazeuser@gmail.com>
date Sat, 02 Aug 2008 14:02:28 +0000
parents fe32943f86ec
children 3b5691f85c0d
rev   line source
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
1 /*
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
2 SDL - Simple DirectMedia Layer
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
4
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
5 This library is free software; you can redistribute it and/or
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
6 modify it under the terms of the GNU Lesser General Public
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
7 License as published by the Free Software Foundation; either
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
9
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
10 This library is distributed in the hope that it will be useful,
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
13 Lesser General Public License for more details.
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
14
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
15 You should have received a copy of the GNU Lesser General Public
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
16 License along with this library; if not, write to the Free Software
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
18
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
19 Sam Lantinga
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
20 slouken@libsdl.org
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
21 */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
22 #include "SDL_config.h"
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
23
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
24 #ifndef _SDL_mouse_c_h
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
25 #define _SDL_mouse_c_h
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
26
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
27 typedef struct SDL_Mouse SDL_Mouse;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
28
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
29 struct SDL_Cursor
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
30 {
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
31 SDL_Mouse *mouse;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
32
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
33 SDL_Cursor *next;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
34
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
35 void *driverdata;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
36 };
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
37
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
38 struct SDL_Mouse
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
39 {
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
40 /* Create a cursor from a surface */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
41 SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
42
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
43 /* Show the specified cursor, or hide if cursor is NULL */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
44 int (*ShowCursor) (SDL_Cursor * cursor);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
45
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
46 /* This is called when a mouse motion event occurs */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
47 void (*MoveCursor) (SDL_Cursor * cursor);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
48
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
49 /* Free a window manager cursor */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
50 void (*FreeCursor) (SDL_Cursor * cursor);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
51
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
52 /* Warp the mouse to (x,y) */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
53 void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x,
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
54 int y);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
55
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
56 /* Free the mouse when it's time */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
57 void (*FreeMouse) (SDL_Mouse * mouse);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
58
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
59 /* Data common to all mice */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
60 SDL_WindowID focus;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
61 int which;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
62 int x;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
63 int y;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
64 int z;/*for future use*/
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
65 int xdelta;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
66 int ydelta;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
67 int pressure;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
68 int pressure_max;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
69 int pressure_min;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
70 int tilt;/*for future use*/
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
71 int rotation;/*for future use*/
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
72 char* name;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
73 Uint8 buttonstate;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
74 SDL_bool relative_mode;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
75 SDL_bool proximity;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
76 SDL_bool flush_motion;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
77
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
78 SDL_Cursor *cursors;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
79 SDL_Cursor *def_cursor;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
80 SDL_Cursor *cur_cursor;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
81 SDL_bool cursor_shown;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
82
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
83 void *driverdata;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
84 };
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
85
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
86
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
87 /* Initialize the mouse subsystem */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
88 extern int SDL_MouseInit(void);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
89
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
90 /* Get the mouse at an index */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
91 extern SDL_Mouse *SDL_GetMouse(int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
92
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
93 /* Add a mouse, possibly reattaching at a particular index (or -1),
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
94 returning the index of the mouse, or -1 if there was an error.
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
95 */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
96 extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name, int pressure_max, int pressure_min);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
97
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
98 /* Remove a mouse at an index, clearing the slot for later */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
99 extern void SDL_DelMouse(int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
100
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
101 /* Clear the button state of a mouse at an index */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
102 extern void SDL_ResetMouse(int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
103
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
104 /* Set the mouse focus window */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
105 extern void SDL_SetMouseFocus(int index, SDL_WindowID windowID);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
106
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
107 /* Send a mouse motion event for a mouse at an index */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
108 extern int SDL_SendMouseMotion(int index, int relative, int x, int y, int z);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
109
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
110 /* Send a mouse button event for a mouse at an index */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
111 extern int SDL_SendMouseButton(int index, Uint8 state, Uint8 button);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
112
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
113 /* Send a mouse wheel event for a mouse at an index */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
114 extern int SDL_SendMouseWheel(int index, int x, int y);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
115
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
116 /* Shutdown the mouse subsystem */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
117 extern void SDL_MouseQuit(void);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
118
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
119 extern int SDL_GetIndexById(int id);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
120
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
121 extern int SDL_SetIndexId(int id, int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
122
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
123 extern int SDL_GetNumOfMice(void);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
124
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
125 extern char* SDL_GetMouseName(int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
126
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
127 extern void SDL_UpdateCoordinates(int x, int y);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
128
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
129 #endif /* _SDL_mouse_c_h */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
130
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
131 /* vi: set ts=4 sw=4 expandtab: */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
132