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 95... | Line 95... | ||
| 95 | } SDL_JoystickType; | 95 | } SDL_JoystickType; | 
| 96 | 96 | ||
| 97 | typedef enum | 97 | typedef enum | 
| 98 | { | 98 | { | 
| 99 | SDL_JOYSTICK_POWER_UNKNOWN = -1, | 99 | SDL_JOYSTICK_POWER_UNKNOWN = -1, | 
| 100 | SDL_JOYSTICK_POWER_EMPTY, | 100 |     SDL_JOYSTICK_POWER_EMPTY,   /* <= 5% */ | 
| 101 | SDL_JOYSTICK_POWER_LOW, | 101 |     SDL_JOYSTICK_POWER_LOW,     /* <= 20% */ | 
| 102 | SDL_JOYSTICK_POWER_MEDIUM, | 102 |     SDL_JOYSTICK_POWER_MEDIUM,  /* <= 70% */ | 
| 103 | SDL_JOYSTICK_POWER_FULL, | 103 |     SDL_JOYSTICK_POWER_FULL,    /* <= 100% */ | 
| 104 | SDL_JOYSTICK_POWER_WIRED, | 104 | SDL_JOYSTICK_POWER_WIRED, | 
| 105 | SDL_JOYSTICK_POWER_MAX | 105 | SDL_JOYSTICK_POWER_MAX | 
| 106 | } SDL_JoystickPowerLevel; | 106 | } SDL_JoystickPowerLevel; | 
| 107 | 107 | ||
| 108 | /* Function prototypes */ | 108 | /* Function prototypes */ | 
| Line 129... | Line 129... | ||
| 129 |  *  Get the implementation dependent name of a joystick. | 129 |  *  Get the implementation dependent name of a joystick. | 
| 130 |  *  This can be called before any joysticks are opened. | 130 |  *  This can be called before any joysticks are opened. | 
| 131 |  *  If no name can be found, this function returns NULL. | 131 |  *  If no name can be found, this function returns NULL. | 
| 132 |  */ | 132 |  */ | 
| 133 | extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); | 133 | extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); | 
| - | 134 | ||
| - | 135 | /** | |
| - | 136 |  *  Get the player index of a joystick, or -1 if it's not available | |
| - | 137 |  *  This can be called before any joysticks are opened. | |
| - | 138 |  */ | |
| - | 139 | extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); | |
| 134 | 140 | ||
| 135 | /** | 141 | /** | 
| 136 |  *  Return the GUID for the joystick at this index | 142 |  *  Return the GUID for the joystick at this index | 
| 137 |  *  This can be called before any joysticks are opened. | 143 |  *  This can be called before any joysticks are opened. | 
| 138 |  */ | 144 |  */ | 
| Line 191... | Line 197... | ||
| 191 | /** | 197 | /** | 
| 192 |  *  Return the name for this currently opened joystick. | 198 |  *  Return the name for this currently opened joystick. | 
| 193 |  *  If no name can be found, this function returns NULL. | 199 |  *  If no name can be found, this function returns NULL. | 
| 194 |  */ | 200 |  */ | 
| 195 | extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); | 201 | extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); | 
| - | 202 | ||
| - | 203 | /** | |
| - | 204 |  *  Get the player index of an opened joystick, or -1 if it's not available | |
| - | 205 |  * | |
| - | 206 |  *  For XInput controllers this returns the XInput user index. | |
| - | 207 |  */ | |
| - | 208 | extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); | |
| 196 | 209 | ||
| 197 | /** | 210 | /** | 
| 198 |  *  Return the GUID for this opened joystick | 211 |  *  Return the GUID for this opened joystick | 
| 199 |  */ | 212 |  */ | 
| 200 | extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); | 213 | extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); | 
| Line 358... | Line 371... | ||
| 358 |  * | 371 |  * | 
| 359 |  *  The button indices start at index 0. | 372 |  *  The button indices start at index 0. | 
| 360 |  */ | 373 |  */ | 
| 361 | extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, | 374 | extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, | 
| 362 | int button); | 375 | int button); | 
| - | 376 | ||
| - | 377 | /** | |
| - | 378 |  *  Trigger a rumble effect | |
| - | 379 |  *  Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. | |
| - | 380 |  * | |
| - | 381 |  *  \param joystick The joystick to vibrate | |
| - | 382 |  *  \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF | |
| - | 383 |  *  \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF | |
| - | 384 |  *  \param duration_ms The duration of the rumble effect, in milliseconds | |
| - | 385 |  * | |
| - | 386 |  *  \return 0, or -1 if rumble isn't supported on this joystick | |
| - | 387 |  */ | |
| - | 388 | extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); | |
| 363 | 389 | ||
| 364 | /** | 390 | /** | 
| 365 |  *  Close a joystick previously opened with SDL_JoystickOpen(). | 391 |  *  Close a joystick previously opened with SDL_JoystickOpen(). | 
| 366 |  */ | 392 |  */ | 
| 367 | extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); | 393 | extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); |