Mercurial > sdl-ios-xcode
annotate include/SDL_mouse.h @ 3542:97eae5a705f9
Make sure we fully clip the first point before starting to adjust the second point.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 11 Dec 2009 09:57:54 +0000 |
parents | d3baf5ac4e37 |
children | f8816ffa210b |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
251
b8688cfdc232
Updated the headers with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
23 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
24 * \file SDL_mouse.h |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
25 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
26 * Include file for SDL mouse event handling. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
27 */ |
0 | 28 |
29 #ifndef _SDL_mouse_h | |
30 #define _SDL_mouse_h | |
31 | |
1356
67114343400d
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
32 #include "SDL_stdinc.h" |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1356
diff
changeset
|
33 #include "SDL_error.h" |
0 | 34 #include "SDL_video.h" |
35 | |
36 #include "begin_code.h" | |
37 /* Set up for C function definitions, even when using C++ */ | |
38 #ifdef __cplusplus | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
39 /* *INDENT-OFF* */ |
0 | 40 extern "C" { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
41 /* *INDENT-ON* */ |
0 | 42 #endif |
43 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
44 typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ |
0 | 45 |
46 /* Function prototypes */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
47 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
48 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
49 * \brief Get the number of mouse input devices available. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
50 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
51 * \sa SDL_SelectMouse() |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
52 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
53 extern DECLSPEC int SDLCALL SDL_GetNumMice(void); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
54 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
55 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
56 * \brief Gets the name of a mouse with the given index. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
57 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
58 * \param index is the index of the mouse, which name is to be returned. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
59 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
60 * \return the name of the mouse with the specified index |
2718
abacf2555bb4
Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents:
2710
diff
changeset
|
61 */ |
abacf2555bb4
Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents:
2710
diff
changeset
|
62 extern DECLSPEC char *SDLCALL SDL_GetMouseName(int index); |
abacf2555bb4
Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents:
2710
diff
changeset
|
63 |
abacf2555bb4
Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents:
2710
diff
changeset
|
64 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
65 * \brief Set the index of the currently selected mouse. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
66 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
67 * \return The index of the previously selected mouse. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
68 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
69 * \note You can query the currently selected mouse by passing an index of -1. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
70 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
71 * \sa SDL_GetNumMice() |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
72 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
73 extern DECLSPEC int SDLCALL SDL_SelectMouse(int index); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
74 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
75 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
76 * \brief Get the window which currently has focus for the specified mouse. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
77 */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
78 extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(int index); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
79 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
80 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
81 * \brief Set relative mouse mode for the specified mouse. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
82 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
83 * \param enabled Whether or not to enable relative mode |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
84 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
85 * \return 0 on success, or -1 if relative mode is not supported. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
86 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
87 * While the mouse is in relative mode, the cursor is hidden, and the |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
88 * driver will try to report continuous motion in the current window. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
89 * Only relative motion events will be delivered, the mouse position |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
90 * will not change. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
91 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
92 * \note This function will flush any pending mouse motion. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
93 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
94 * \sa SDL_GetRelativeMouseMode() |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
95 */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
96 extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index, |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
97 SDL_bool enabled); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
98 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
99 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
100 * \brief Query whether relative mouse mode is enabled for the specified mouse. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
101 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
102 * \sa SDL_SetRelativeMouseMode() |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
103 */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
104 extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(int index); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
105 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
106 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
107 * \brief Retrieve the current state of the specified mouse. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
108 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
109 * The current button state is returned as a button bitmask, which can |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
110 * be tested using the SDL_BUTTON(X) macros, and x and y are set to the |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
111 * mouse cursor position relative to the focus window for the currently |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
112 * selected mouse. You can pass NULL for either x or y. |
0 | 113 */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
114 extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int index, int *x, int *y); |
0 | 115 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
116 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
117 * \brief Retrieve the state of the specified mouse. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
118 * |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
119 * The current button state is returned as a button bitmask, which can |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
120 * be tested using the SDL_BUTTON(X) macros, and x and y are set to the |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
121 * mouse deltas since the last call to SDL_GetRelativeMouseState(). |
0 | 122 */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
123 extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int index, int *x, |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
124 int *y); |
0 | 125 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
126 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
127 * \brief Moves the currently selected mouse to the given position within the window. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
128 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
129 * \param windowID The window to move the mouse into, or 0 for the current mouse focus |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
130 * \param x The x coordinate within the window |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
131 * \param y The y coordinate within the window |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
132 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
133 * \note This function generates a mouse motion event |
0 | 134 */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
135 extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_WindowID windowID, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
136 int x, int y); |
0 | 137 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
138 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
139 * \brief Create a cursor for the currently selected mouse, using the |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
140 * specified bitmap data and mask (in MSB format). |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
141 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
142 * The cursor width must be a multiple of 8 bits. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
143 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
144 * The cursor is created in black and white according to the following: |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
145 * <table> |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
146 * <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr> |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
147 * <tr><td> 0 </td><td> 1 </td><td> White </td></tr> |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
148 * <tr><td> 1 </td><td> 1 </td><td> Black </td></tr> |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
149 * <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr> |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
150 * <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
151 if not. </td></tr> |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
152 * </table> |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
153 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
154 * \sa SDL_FreeCursor() |
0 | 155 */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
156 extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
157 const Uint8 * mask, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
158 int w, int h, int hot_x, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
159 int hot_y); |
0 | 160 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
161 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
162 * \brief Set the active cursor for the currently selected mouse. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
163 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
164 * \note The cursor must have been created for the selected mouse. |
0 | 165 */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
166 extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); |
0 | 167 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
168 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
169 * \brief Return the active cursor for the currently selected mouse. |
0 | 170 */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
171 extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); |
0 | 172 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
173 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
174 * \brief Frees a cursor created with SDL_CreateCursor(). |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
175 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
176 * \sa SDL_CreateCursor() |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
177 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
178 extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
179 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
180 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
181 * \brief Toggle whether or not the cursor is shown for the currently selected |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
182 * mouse. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
183 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
184 * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
185 * state. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
186 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
187 * \return 1 if the cursor is shown, or 0 if the cursor is hidden. |
0 | 188 */ |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
189 extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); |
0 | 190 |
2718
abacf2555bb4
Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents:
2710
diff
changeset
|
191 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
192 * \brief Gets the number of cursors a pointing device supports. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
193 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
194 * Useful for tablet users. Useful only under Windows. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
195 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
196 * \param index is the index of the pointing device, which number of cursors we |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
197 * want to receive. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
198 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
199 * \return the number of cursors supported by the pointing device. On Windows |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
200 * if a device is a tablet it returns a number >=1. Normal mice always |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
201 * return 1. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
202 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
203 * On Linux every device reports one cursor. |
2718
abacf2555bb4
Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents:
2710
diff
changeset
|
204 */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
205 extern DECLSPEC int SDLCALL SDL_GetCursorsNumber(int index); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
206 |
2718
abacf2555bb4
Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents:
2710
diff
changeset
|
207 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
208 * \brief Returns the index of the current cursor used by a specific pointing |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
209 * device. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
210 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
211 * Useful only under Windows. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
212 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
213 * \param index is the index of the pointing device, which cursor index we want |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
214 * to receive. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
215 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
216 * \return the index of the cursor currently used by a specific pointing |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
217 * device. Always 0 under Linux. On Windows if the device isn't a |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
218 * tablet it returns 0. If the device is the tablet it returns the |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
219 * cursor index. 0 - stylus, 1 - eraser, 2 - cursor. |
2718
abacf2555bb4
Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents:
2710
diff
changeset
|
220 */ |
2710
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
221 extern DECLSPEC int SDLCALL SDL_GetCurrentCursor(int index); |
44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2284
diff
changeset
|
222 |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
223 /** |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
224 * Used as a mask when testing buttons in buttonstate. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
225 * - Button 1: Left mouse button |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
226 * - Button 2: Middle mouse button |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
227 * - Button 3: Right mouse button |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
228 */ |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
229 #define SDL_BUTTON(X) (1 << ((X)-1)) |
0 | 230 #define SDL_BUTTON_LEFT 1 |
231 #define SDL_BUTTON_MIDDLE 2 | |
232 #define SDL_BUTTON_RIGHT 3 | |
2284 | 233 #define SDL_BUTTON_X1 4 |
234 #define SDL_BUTTON_X2 5 | |
0 | 235 #define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) |
236 #define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) | |
237 #define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) | |
2284 | 238 #define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) |
239 #define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) | |
0 | 240 |
241 | |
242 /* Ends C function definitions when using C++ */ | |
243 #ifdef __cplusplus | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
244 /* *INDENT-OFF* */ |
0 | 245 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
246 /* *INDENT-ON* */ |
0 | 247 #endif |
248 #include "close_code.h" | |
249 | |
250 #endif /* _SDL_mouse_h */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
251 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
252 /* vi: set ts=4 sw=4 expandtab: */ |