comparison include/SDL_mouse.h @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents c71e05b4dc2e
children 4da1ee79c9af
comparison
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 22
23 /* Include file for SDL mouse event handling */ 23 /**
24 * \file SDL_mouse.h
25 *
26 * Include file for SDL mouse event handling
27 */
24 28
25 #ifndef _SDL_mouse_h 29 #ifndef _SDL_mouse_h
26 #define _SDL_mouse_h 30 #define _SDL_mouse_h
27 31
28 #include "SDL_stdinc.h" 32 #include "SDL_stdinc.h"
30 #include "SDL_video.h" 34 #include "SDL_video.h"
31 35
32 #include "begin_code.h" 36 #include "begin_code.h"
33 /* Set up for C function definitions, even when using C++ */ 37 /* Set up for C function definitions, even when using C++ */
34 #ifdef __cplusplus 38 #ifdef __cplusplus
39 /* *INDENT-OFF* */
35 extern "C" { 40 extern "C" {
41 /* *INDENT-ON* */
36 #endif 42 #endif
37 43
38 typedef struct WMcursor WMcursor; /* Implementation dependent */ 44 typedef struct WMcursor WMcursor; /* Implementation dependent */
39 typedef struct SDL_Cursor { 45 typedef struct SDL_Cursor
40 SDL_Rect area; /* The area of the mouse cursor */ 46 {
41 Sint16 hot_x, hot_y; /* The "tip" of the cursor */ 47 SDL_Rect area; /* The area of the mouse cursor */
42 Uint8 *data; /* B/W cursor data */ 48 Sint16 hot_x, hot_y; /* The "tip" of the cursor */
43 Uint8 *mask; /* B/W cursor mask */ 49 Uint8 *data; /* B/W cursor data */
44 Uint8 *save[2]; /* Place to save cursor area */ 50 Uint8 *mask; /* B/W cursor mask */
45 WMcursor *wm_cursor; /* Window-manager cursor */ 51 Uint8 *save[2]; /* Place to save cursor area */
52 WMcursor *wm_cursor; /* Window-manager cursor */
46 } SDL_Cursor; 53 } SDL_Cursor;
47 54
48 /* Function prototypes */ 55 /* Function prototypes */
49 /* 56 /*
50 * Retrieve the current state of the mouse. 57 * Retrieve the current state of the mouse.
51 * The current button state is returned as a button bitmask, which can 58 * The current button state is returned as a button bitmask, which can
52 * be tested using the SDL_BUTTON(X) macros, and x and y are set to the 59 * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
53 * current mouse cursor position. You can pass NULL for either x or y. 60 * current mouse cursor position. You can pass NULL for either x or y.
54 */ 61 */
55 extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y); 62 extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState (int *x, int *y);
56 63
57 /* 64 /*
58 * Retrieve the current state of the mouse. 65 * Retrieve the current state of the mouse.
59 * The current button state is returned as a button bitmask, which can 66 * The current button state is returned as a button bitmask, which can
60 * be tested using the SDL_BUTTON(X) macros, and x and y are set to the 67 * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
61 * mouse deltas since the last call to SDL_GetRelativeMouseState(). 68 * mouse deltas since the last call to SDL_GetRelativeMouseState().
62 */ 69 */
63 extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); 70 extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState (int *x, int *y);
64 71
65 /* 72 /*
66 * Set the position of the mouse cursor (generates a mouse motion event) 73 * Set the position of the mouse cursor (generates a mouse motion event)
67 */ 74 */
68 extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y); 75 extern DECLSPEC void SDLCALL SDL_WarpMouse (Uint16 x, Uint16 y);
69 76
70 /* 77 /*
71 * Create a cursor using the specified data and mask (in MSB format). 78 * Create a cursor using the specified data and mask (in MSB format).
72 * The cursor width must be a multiple of 8 bits. 79 * The cursor width must be a multiple of 8 bits.
73 * 80 *
78 * 0 0 Transparent 85 * 0 0 Transparent
79 * 1 0 Inverted color if possible, black if not. 86 * 1 0 Inverted color if possible, black if not.
80 * 87 *
81 * Cursors created with this function must be freed with SDL_FreeCursor(). 88 * Cursors created with this function must be freed with SDL_FreeCursor().
82 */ 89 */
83 extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor 90 extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor
84 (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); 91 (Uint8 * data, Uint8 * mask, int w, int h, int hot_x, int hot_y);
85 92
86 /* 93 /*
87 * Set the currently active cursor to the specified one. 94 * Set the currently active cursor to the specified one.
88 * If the cursor is currently visible, the change will be immediately 95 * If the cursor is currently visible, the change will be immediately
89 * represented on the display. 96 * represented on the display.
90 */ 97 */
91 extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor); 98 extern DECLSPEC void SDLCALL SDL_SetCursor (SDL_Cursor * cursor);
92 99
93 /* 100 /*
94 * Returns the currently active cursor. 101 * Returns the currently active cursor.
95 */ 102 */
96 extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void); 103 extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor (void);
97 104
98 /* 105 /*
99 * Deallocates a cursor created with SDL_CreateCursor(). 106 * Deallocates a cursor created with SDL_CreateCursor().
100 */ 107 */
101 extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor); 108 extern DECLSPEC void SDLCALL SDL_FreeCursor (SDL_Cursor * cursor);
102 109
103 /* 110 /*
104 * Toggle whether or not the cursor is shown on the screen. 111 * Toggle whether or not the cursor is shown on the screen.
105 * The cursor start off displayed, but can be turned off. 112 * The cursor start off displayed, but can be turned off.
106 * SDL_ShowCursor() returns 1 if the cursor was being displayed 113 * SDL_ShowCursor() returns 1 if the cursor was being displayed
107 * before the call, or 0 if it was not. You can query the current 114 * before the call, or 0 if it was not. You can query the current
108 * state by passing a 'toggle' value of -1. 115 * state by passing a 'toggle' value of -1.
109 */ 116 */
110 extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); 117 extern DECLSPEC int SDLCALL SDL_ShowCursor (int toggle);
111 118
112 /* Used as a mask when testing buttons in buttonstate 119 /* Used as a mask when testing buttons in buttonstate
113 Button 1: Left mouse button 120 Button 1: Left mouse button
114 Button 2: Middle mouse button 121 Button 2: Middle mouse button
115 Button 3: Right mouse button 122 Button 3: Right mouse button
127 #define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) 134 #define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
128 135
129 136
130 /* Ends C function definitions when using C++ */ 137 /* Ends C function definitions when using C++ */
131 #ifdef __cplusplus 138 #ifdef __cplusplus
139 /* *INDENT-OFF* */
132 } 140 }
141 /* *INDENT-ON* */
133 #endif 142 #endif
134 #include "close_code.h" 143 #include "close_code.h"
135 144
136 #endif /* _SDL_mouse_h */ 145 #endif /* _SDL_mouse_h */
146
147 /* vi: set ts=4 sw=4 expandtab: */