Rev 1 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 8 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | Simple DirectMedia Layer |
2 | Simple DirectMedia Layer |
3 | Copyright (C) 1997- |
3 | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
4 | 4 | ||
5 | This software is provided 'as-is', without any express or implied |
5 | This software is provided 'as-is', without any express or implied |
6 | warranty. In no event will the authors be held liable for any damages |
6 | warranty. In no event will the authors be held liable for any damages |
7 | arising from the use of this software. |
7 | arising from the use of this software. |
8 | 8 | ||
Line 172... | Line 172... | ||
172 | * Get the implementation dependent name of a game controller. |
172 | * Get the implementation dependent name of a game controller. |
173 | * This can be called before any controllers are opened. |
173 | * This can be called before any controllers are opened. |
174 | * If no name can be found, this function returns NULL. |
174 | * If no name can be found, this function returns NULL. |
175 | */ |
175 | */ |
176 | extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); |
176 | extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); |
- | 177 | ||
- | 178 | /** |
|
- | 179 | * Get the mapping of a game controller. |
|
- | 180 | * This can be called before any controllers are opened. |
|
- | 181 | * |
|
- | 182 | * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available |
|
- | 183 | */ |
|
- | 184 | extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); |
|
177 | 185 | ||
178 | /** |
186 | /** |
179 | * Open a game controller for use. |
187 | * Open a game controller for use. |
180 | * The index passed as an argument refers to the N'th game controller on the system. |
188 | * The index passed as an argument refers to the N'th game controller on the system. |
181 | * This index is not the value which will identify this controller in future |
189 | * This index is not the value which will identify this controller in future |
Line 193... | Line 201... | ||
193 | 201 | ||
194 | /** |
202 | /** |
195 | * Return the name for this currently opened controller |
203 | * Return the name for this currently opened controller |
196 | */ |
204 | */ |
197 | extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); |
205 | extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); |
- | 206 | ||
- | 207 | /** |
|
- | 208 | * Get the player index of an opened game controller, or -1 if it's not available |
|
- | 209 | * |
|
- | 210 | * For XInput controllers this returns the XInput user index. |
|
- | 211 | */ |
|
- | 212 | extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); |
|
198 | 213 | ||
199 | /** |
214 | /** |
200 | * Get the USB vendor ID of an opened controller, if available. |
215 | * Get the USB vendor ID of an opened controller, if available. |
201 | * If the vendor ID isn't available this function returns 0. |
216 | * If the vendor ID isn't available this function returns 0. |
202 | */ |
217 | */ |
Line 342... | Line 357... | ||
342 | * |
357 | * |
343 | * The button indices start at index 0. |
358 | * The button indices start at index 0. |
344 | */ |
359 | */ |
345 | extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, |
360 | extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, |
346 | SDL_GameControllerButton button); |
361 | SDL_GameControllerButton button); |
- | 362 | ||
- | 363 | /** |
|
- | 364 | * Trigger a rumble effect |
|
- | 365 | * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. |
|
- | 366 | * |
|
- | 367 | * \param gamecontroller The controller to vibrate |
|
- | 368 | * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF |
|
- | 369 | * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF |
|
- | 370 | * \param duration_ms The duration of the rumble effect, in milliseconds |
|
- | 371 | * |
|
- | 372 | * \return 0, or -1 if rumble isn't supported on this joystick |
|
- | 373 | */ |
|
- | 374 | extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); |
|
347 | 375 | ||
348 | /** |
376 | /** |
349 | * Close a controller previously opened with SDL_GameControllerOpen(). |
377 | * Close a controller previously opened with SDL_GameControllerOpen(). |
350 | */ |
378 | */ |
351 | extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller); |
379 | extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller); |