Mercurial > sdl-ios-xcode
comparison src/events/SDL_mouse_c.h @ 1671:89f7510fe17a SDL-1.3
Moved the cursor handling into the mouse code.
Added support for multiple mice, potentially dynamically added and removed.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 09 Jun 2006 06:42:42 +0000 |
parents | eef792d31de8 |
children | 5daa04d862f1 |
comparison
equal
deleted
inserted
replaced
1670:eef792d31de8 | 1671:89f7510fe17a |
---|---|
22 #include "SDL_config.h" | 22 #include "SDL_config.h" |
23 | 23 |
24 #ifndef _SDL_mouse_c_h | 24 #ifndef _SDL_mouse_c_h |
25 #define _SDL_mouse_c_h | 25 #define _SDL_mouse_c_h |
26 | 26 |
27 typedef struct | 27 typedef struct SDL_Mouse SDL_Mouse; |
28 | |
29 struct SDL_Cursor | |
28 { | 30 { |
31 SDL_Mouse *mouse; | |
32 | |
33 SDL_Cursor *next; | |
34 | |
35 void *driverdata; | |
36 }; | |
37 | |
38 struct SDL_Mouse | |
39 { | |
40 /* Create a cursor from a surface */ | |
41 SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y); | |
42 | |
43 /* Show the specified cursor, or hide if cursor is NULL */ | |
44 int (*ShowCursor) (SDL_Cursor * cursor); | |
45 | |
46 /* This is called when a mouse motion event occurs */ | |
47 void (*MoveCursor) (SDL_Cursor * cursor); | |
48 | |
49 /* Free a window manager cursor */ | |
50 void (*FreeCursor) (SDL_Cursor * cursor); | |
51 | |
52 /* Warp the mouse to (x,y) */ | |
53 void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x, | |
54 int y); | |
55 | |
56 /* Free the mouse when it's time */ | |
57 void (*FreeMouse) (SDL_Mouse * mouse); | |
58 | |
59 /* Data common to all mice */ | |
29 SDL_WindowID focus; | 60 SDL_WindowID focus; |
30 int x; | 61 int x; |
31 int y; | 62 int y; |
32 int xdelta; | 63 int xdelta; |
33 int ydelta; | 64 int ydelta; |
34 Uint8 buttonstate; | 65 Uint8 buttonstate; |
35 } SDL_Mouse; | |
36 | 66 |
67 SDL_Cursor *cursors; | |
68 SDL_Cursor *def_cursor; | |
69 SDL_Cursor *cur_cursor; | |
70 SDL_bool cursor_shown; | |
71 | |
72 void *driverdata; | |
73 }; | |
74 | |
75 | |
76 /* Initialize the mouse subsystem */ | |
37 extern int SDL_MouseInit(void); | 77 extern int SDL_MouseInit(void); |
38 extern int SDL_AddMouse(SDL_WindowID focus, int x, int y, Uint8 buttonstate); | 78 |
79 /* Get the mouse at an index */ | |
39 extern SDL_Mouse *SDL_GetMouse(int index); | 80 extern SDL_Mouse *SDL_GetMouse(int index); |
81 | |
82 /* Add a mouse, possibly reattaching at a particular index (or -1), | |
83 returning the index of the mouse, or -1 if there was an error. | |
84 */ | |
85 extern int SDL_AddMouse(const SDL_Mouse * mouse, int index); | |
86 | |
87 /* Remove a mouse at an index, clearing the slot for later */ | |
88 extern void SDL_DelMouse(int index); | |
89 | |
90 /* Clear the button state of a mouse at an index */ | |
91 extern void SDL_ResetMouse(int index); | |
92 | |
93 /* Send a mouse motion event for a mouse at an index */ | |
40 extern int SDL_SendMouseMotion(int index, SDL_WindowID windowID, int relative, | 94 extern int SDL_SendMouseMotion(int index, SDL_WindowID windowID, int relative, |
41 int x, int y); | 95 int x, int y); |
96 | |
97 /* Send a mouse button event for a mouse at an index */ | |
42 extern int SDL_SendMouseButton(int index, SDL_WindowID windowID, Uint8 state, | 98 extern int SDL_SendMouseButton(int index, SDL_WindowID windowID, Uint8 state, |
43 Uint8 button); | 99 Uint8 button); |
100 | |
101 /* Shutdown the mouse subsystem */ | |
44 extern void SDL_MouseQuit(void); | 102 extern void SDL_MouseQuit(void); |
45 | 103 |
46 #endif /* _SDL_mouse_c_h */ | 104 #endif /* _SDL_mouse_c_h */ |
47 | 105 |
48 /* vi: set ts=4 sw=4 expandtab: */ | 106 /* vi: set ts=4 sw=4 expandtab: */ |