Mercurial > sdl-ios-xcode
comparison include/SDL_joystick.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 joystick event handling */ | 23 /** |
24 * \file SDL_joystick.h | |
25 * | |
26 * Include file for SDL joystick event handling | |
27 */ | |
24 | 28 |
25 #ifndef _SDL_joystick_h | 29 #ifndef _SDL_joystick_h |
26 #define _SDL_joystick_h | 30 #define _SDL_joystick_h |
27 | 31 |
28 #include "SDL_stdinc.h" | 32 #include "SDL_stdinc.h" |
29 #include "SDL_error.h" | 33 #include "SDL_error.h" |
30 | 34 |
31 #include "begin_code.h" | 35 #include "begin_code.h" |
32 /* Set up for C function definitions, even when using C++ */ | 36 /* Set up for C function definitions, even when using C++ */ |
33 #ifdef __cplusplus | 37 #ifdef __cplusplus |
38 /* *INDENT-OFF* */ | |
34 extern "C" { | 39 extern "C" { |
40 /* *INDENT-ON* */ | |
35 #endif | 41 #endif |
36 | 42 |
37 /* In order to use these functions, SDL_Init() must have been called | 43 /* In order to use these functions, SDL_Init() must have been called |
38 with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system | 44 with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system |
39 for joysticks, and load appropriate drivers. | 45 for joysticks, and load appropriate drivers. |
46 | 52 |
47 /* Function prototypes */ | 53 /* Function prototypes */ |
48 /* | 54 /* |
49 * Count the number of joysticks attached to the system | 55 * Count the number of joysticks attached to the system |
50 */ | 56 */ |
51 extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); | 57 extern DECLSPEC int SDLCALL SDL_NumJoysticks (void); |
52 | 58 |
53 /* | 59 /* |
54 * Get the implementation dependent name of a joystick. | 60 * Get the implementation dependent name of a joystick. |
55 * This can be called before any joysticks are opened. | 61 * This can be called before any joysticks are opened. |
56 * If no name can be found, this function returns NULL. | 62 * If no name can be found, this function returns NULL. |
57 */ | 63 */ |
58 extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index); | 64 extern DECLSPEC const char *SDLCALL SDL_JoystickName (int device_index); |
59 | 65 |
60 /* | 66 /* |
61 * Open a joystick for use - the index passed as an argument refers to | 67 * Open a joystick for use - the index passed as an argument refers to |
62 * the N'th joystick on the system. This index is the value which will | 68 * the N'th joystick on the system. This index is the value which will |
63 * identify this joystick in future joystick events. | 69 * identify this joystick in future joystick events. |
64 * | 70 * |
65 * This function returns a joystick identifier, or NULL if an error occurred. | 71 * This function returns a joystick identifier, or NULL if an error occurred. |
66 */ | 72 */ |
67 extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index); | 73 extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen (int device_index); |
68 | 74 |
69 /* | 75 /* |
70 * Returns 1 if the joystick has been opened, or 0 if it has not. | 76 * Returns 1 if the joystick has been opened, or 0 if it has not. |
71 */ | 77 */ |
72 extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index); | 78 extern DECLSPEC int SDLCALL SDL_JoystickOpened (int device_index); |
73 | 79 |
74 /* | 80 /* |
75 * Get the device index of an opened joystick. | 81 * Get the device index of an opened joystick. |
76 */ | 82 */ |
77 extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick); | 83 extern DECLSPEC int SDLCALL SDL_JoystickIndex (SDL_Joystick * joystick); |
78 | 84 |
79 /* | 85 /* |
80 * Get the number of general axis controls on a joystick | 86 * Get the number of general axis controls on a joystick |
81 */ | 87 */ |
82 extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); | 88 extern DECLSPEC int SDLCALL SDL_JoystickNumAxes (SDL_Joystick * joystick); |
83 | 89 |
84 /* | 90 /* |
85 * Get the number of trackballs on a joystick | 91 * Get the number of trackballs on a joystick |
86 * Joystick trackballs have only relative motion events associated | 92 * Joystick trackballs have only relative motion events associated |
87 * with them and their state cannot be polled. | 93 * with them and their state cannot be polled. |
88 */ | 94 */ |
89 extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); | 95 extern DECLSPEC int SDLCALL SDL_JoystickNumBalls (SDL_Joystick * joystick); |
90 | 96 |
91 /* | 97 /* |
92 * Get the number of POV hats on a joystick | 98 * Get the number of POV hats on a joystick |
93 */ | 99 */ |
94 extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); | 100 extern DECLSPEC int SDLCALL SDL_JoystickNumHats (SDL_Joystick * joystick); |
95 | 101 |
96 /* | 102 /* |
97 * Get the number of buttons on a joystick | 103 * Get the number of buttons on a joystick |
98 */ | 104 */ |
99 extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); | 105 extern DECLSPEC int SDLCALL SDL_JoystickNumButtons (SDL_Joystick * joystick); |
100 | 106 |
101 /* | 107 /* |
102 * Update the current state of the open joysticks. | 108 * Update the current state of the open joysticks. |
103 * This is called automatically by the event loop if any joystick | 109 * This is called automatically by the event loop if any joystick |
104 * events are enabled. | 110 * events are enabled. |
105 */ | 111 */ |
106 extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); | 112 extern DECLSPEC void SDLCALL SDL_JoystickUpdate (void); |
107 | 113 |
108 /* | 114 /* |
109 * Enable/disable joystick event polling. | 115 * Enable/disable joystick event polling. |
110 * If joystick events are disabled, you must call SDL_JoystickUpdate() | 116 * If joystick events are disabled, you must call SDL_JoystickUpdate() |
111 * yourself and check the state of the joystick when you want joystick | 117 * yourself and check the state of the joystick when you want joystick |
112 * information. | 118 * information. |
113 * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. | 119 * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. |
114 */ | 120 */ |
115 extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); | 121 extern DECLSPEC int SDLCALL SDL_JoystickEventState (int state); |
116 | 122 |
117 /* | 123 /* |
118 * Get the current state of an axis control on a joystick | 124 * Get the current state of an axis control on a joystick |
119 * The state is a value ranging from -32768 to 32767. | 125 * The state is a value ranging from -32768 to 32767. |
120 * The axis indices start at index 0. | 126 * The axis indices start at index 0. |
121 */ | 127 */ |
122 extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); | 128 extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis (SDL_Joystick * joystick, |
129 int axis); | |
123 | 130 |
124 /* | 131 /* |
125 * Get the current state of a POV hat on a joystick | 132 * Get the current state of a POV hat on a joystick |
126 * The return value is one of the following positions: | 133 * The return value is one of the following positions: |
127 */ | 134 */ |
135 #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) | 142 #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) |
136 #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) | 143 #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) |
137 /* | 144 /* |
138 * The hat indices start at index 0. | 145 * The hat indices start at index 0. |
139 */ | 146 */ |
140 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); | 147 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat (SDL_Joystick * joystick, |
148 int hat); | |
141 | 149 |
142 /* | 150 /* |
143 * Get the ball axis change since the last poll | 151 * Get the ball axis change since the last poll |
144 * This returns 0, or -1 if you passed it invalid parameters. | 152 * This returns 0, or -1 if you passed it invalid parameters. |
145 * The ball indices start at index 0. | 153 * The ball indices start at index 0. |
146 */ | 154 */ |
147 extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); | 155 extern DECLSPEC int SDLCALL SDL_JoystickGetBall (SDL_Joystick * joystick, |
156 int ball, int *dx, int *dy); | |
148 | 157 |
149 /* | 158 /* |
150 * Get the current state of a button on a joystick | 159 * Get the current state of a button on a joystick |
151 * The button indices start at index 0. | 160 * The button indices start at index 0. |
152 */ | 161 */ |
153 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button); | 162 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton (SDL_Joystick * joystick, |
163 int button); | |
154 | 164 |
155 /* | 165 /* |
156 * Close a joystick previously opened with SDL_JoystickOpen() | 166 * Close a joystick previously opened with SDL_JoystickOpen() |
157 */ | 167 */ |
158 extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); | 168 extern DECLSPEC void SDLCALL SDL_JoystickClose (SDL_Joystick * joystick); |
159 | 169 |
160 | 170 |
161 /* Ends C function definitions when using C++ */ | 171 /* Ends C function definitions when using C++ */ |
162 #ifdef __cplusplus | 172 #ifdef __cplusplus |
173 /* *INDENT-OFF* */ | |
163 } | 174 } |
175 /* *INDENT-ON* */ | |
164 #endif | 176 #endif |
165 #include "close_code.h" | 177 #include "close_code.h" |
166 | 178 |
167 #endif /* _SDL_joystick_h */ | 179 #endif /* _SDL_joystick_h */ |
180 | |
181 /* vi: set ts=4 sw=4 expandtab: */ |