|
Size: 756
Comment: create page, add content (Rev 5540)
|
← Revision 9 as of 2015-04-26 18:55:49 ⇥
Size: 1417
Comment: Sorted related functions, see SGFunctions.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 12: | Line 12: |
| const char* SDL_JoystickName(int device_index) | const char* SDL_JoystickName(SDL_Joystick* joystick) |
| Line 16: | Line 16: |
| ||'''device_index'''||the index of the joystick to query|| | ||'''joystick'''||the SDL_Joystick obtained from [[SDL_JoystickOpen]]()|| |
| Line 19: | Line 19: |
| The name of the selected joystick. If no name can be found, this function returns NULL. | Returns the name of the selected joystick. If no name can be found, this function returns NULL; call [[SDL_GetError]]() for more information. |
| Line 22: | Line 22: |
| Line 23: | Line 24: |
| You can add your code example here | /* Print the names of all attached joysticks */ int num_joy, i; num_joy = SDL_NumJoysticks(); printf("%d joysticks found\n", num_joy); for(i = 0; i < num_joy; i++) { SDL_Joystick *joystick = SDL_JoystickOpen(i); printf("%s\n", SDL_JoystickName(joystick)); } |
| Line 27: | Line 36: |
| This can be called before any joysticks are opened. | ''You can add useful comments here'' ##Leave this section as-is unless you have a remark to put in. In that case, replace ''You can add useful comments here'' with your remark(s) following the Style Guide instructions. Leave the rest of the markup alone and delete this comment. == Version == This function is available since SDL 2.0.0. |
| Line 30: | Line 44: |
| .[[SDL_JoystickNameForIndex]] .[[SDL_JoystickOpen]] |
DRAFT |
SDL_JoystickName
Use this function to get the implementation dependent name of a joystick.
Contents
Syntax
const char* SDL_JoystickName(SDL_Joystick* joystick)
Function Parameters
joystick |
the SDL_Joystick obtained from SDL_JoystickOpen() |
Return Value
Returns the name of the selected joystick. If no name can be found, this function returns NULL; call SDL_GetError() for more information.
Code Examples
/* Print the names of all attached joysticks */
int num_joy, i;
num_joy = SDL_NumJoysticks();
printf("%d joysticks found\n", num_joy);
for(i = 0; i < num_joy; i++)
{
SDL_Joystick *joystick = SDL_JoystickOpen(i);
printf("%s\n", SDL_JoystickName(joystick));
}
Remarks
You can add useful comments here
Version
This function is available since SDL 2.0.0.
