SDL  2.0
SDL_joystick_c.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4 
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
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef SDL_joystick_c_h_
23 #define SDL_joystick_c_h_
24 
25 #include "../SDL_internal.h"
26 
27 /* Useful functions and variables from SDL_joystick.c */
28 #include "SDL_gamecontroller.h"
29 #include "SDL_joystick.h"
30 
31 struct _SDL_JoystickDriver;
32 
33 /* Initialization and shutdown functions */
34 extern int SDL_JoystickInit(void);
35 extern void SDL_JoystickQuit(void);
36 
37 /* Function to get the next available joystick instance ID */
39 
40 /* Initialization and shutdown functions */
41 extern int SDL_GameControllerInitMappings(void);
42 extern void SDL_GameControllerQuitMappings(void);
43 extern int SDL_GameControllerInit(void);
44 extern void SDL_GameControllerQuit(void);
45 
46 /* Function to get the joystick driver and device index for an API device index */
47 extern SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, struct _SDL_JoystickDriver **driver, int *driver_index);
48 
49 /* Function to return the device index for a joystick ID, or -1 if not found */
51 
52 /* Function to extract information from an SDL joystick GUID */
53 extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version);
54 
55 /* Function to get a custom name for a controller manufacturer, if it's available */
56 extern const char *SDL_GetCustomJoystickManufacturer(const char *manufacturer);
57 
58 /* Function to get a custom name for a controller, if it's available */
59 extern const char *SDL_GetCustomJoystickName(Uint16 vendor, Uint16 product);
60 
61 /* Function to return the type of a controller */
63 extern SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol);
64 
65 /* Function to return whether a joystick is a Nintendo Switch Pro controller */
67 
68 /* Function to return whether a joystick is a Steam Controller */
69 extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id);
70 
71 /* Function to return whether a joystick guid comes from the XInput driver */
73 
74 /* Function to return whether a joystick guid comes from the HIDAPI driver */
76 
77 /* Function to return whether a joystick should be ignored */
78 extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid);
79 
80 /* Function to return whether a joystick name and GUID is a game controller */
82 
83 /* Function to return whether a game controller should be ignored */
85 
86 /* Handle delayed guide button on a game controller */
87 extern void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick);
88 
89 /* Internal event queueing functions */
90 extern void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance);
91 extern void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance);
92 extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick,
94 extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick,
95  Uint8 ball, Sint16 xrel, Sint16 yrel);
96 extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick,
97  Uint8 hat, Uint8 value);
98 extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick,
100 extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick,
101  SDL_JoystickPowerLevel ePowerLevel);
102 
103 /* Internal sanity checking functions */
104 extern SDL_bool SDL_PrivateJoystickValid(SDL_Joystick * joystick);
105 
106 #endif /* SDL_joystick_c_h_ */
107 
108 /* vi: set ts=4 sw=4 expandtab: */
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_PrivateJoystickRemoved
void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
Definition: SDL_joystick.c:987
SDL_PrivateJoystickBatteryLevel
void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel ePowerLevel)
Definition: SDL_joystick.c:2035
SDL_PrivateJoystickAdded
void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
Definition: SDL_joystick.c:921
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_IsJoystickHIDAPI
SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid)
Definition: SDL_joystick.c:1547
SDL_joystick.h
SDL_JoystickID
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:81
SDL_GameControllerQuit
void SDL_GameControllerQuit(void)
Definition: SDL_gamecontroller.c:1994
SDL_IsJoystickNintendoSwitchProInputOnly
SDL_bool SDL_IsJoystickNintendoSwitchProInputOnly(Uint16 vendor_id, Uint16 product_id)
Definition: SDL_joystick.c:1526
SDL_JoystickPowerLevel
SDL_JoystickPowerLevel
Definition: SDL_joystick.h:98
SDL_PrivateJoystickHat
int SDL_PrivateJoystickHat(SDL_Joystick *joystick, Uint8 hat, Uint8 value)
Definition: SDL_joystick.c:1086
SDL_JoystickInit
int SDL_JoystickInit(void)
Definition: SDL_joystick.c:201
SDL_JoystickQuit
void SDL_JoystickQuit(void)
Definition: SDL_joystick.c:858
SDL_GetCustomJoystickManufacturer
const char * SDL_GetCustomJoystickManufacturer(const char *manufacturer)
Definition: SDL_joystick.c:1373
SDL_GameControllerHandleDelayedGuideButton
void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick)
Definition: SDL_gamecontroller.c:2151
SDL_GetJoystickGameControllerTypeFromGUID
SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name)
Definition: SDL_joystick.c:1392
Sint16
int16_t Sint16
Definition: SDL_stdinc.h:185
SDL_PrivateJoystickBall
int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sint16 yrel)
Definition: SDL_joystick.c:1126
SDL_IsJoystickXInput
SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid)
Definition: SDL_joystick.c:1541
SDL_PrivateJoystickAxis
int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
Definition: SDL_joystick.c:1023
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:663
SDL_GetCustomJoystickName
const char * SDL_GetCustomJoystickName(Uint16 vendor, Uint16 product)
Definition: SDL_joystick.c:1386
SDL_PrivateJoystickValid
SDL_bool SDL_PrivateJoystickValid(SDL_Joystick *joystick)
Definition: SDL_joystick.c:480
SDL_gamecontroller.h
SDL_GameControllerInitMappings
int SDL_GameControllerInitMappings(void)
Definition: SDL_gamecontroller.c:1370
SDL_IsJoystickSteamController
SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id)
Definition: SDL_joystick.c:1533
SDL_ShouldIgnoreGameController
SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
Definition: SDL_gamecontroller.c:1511
SDL_GameControllerInit
int SDL_GameControllerInit(void)
Definition: SDL_gamecontroller.c:1399
axis
SDL_Texture * axis
Definition: testgamecontroller.c:67
SDL_GameControllerQuitMappings
void SDL_GameControllerQuitMappings(void)
Definition: SDL_gamecontroller.c:2005
SDL_PrivateJoystickButton
int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
Definition: SDL_joystick.c:1162
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:701
SDL_GameControllerType
SDL_GameControllerType
Definition: SDL_gamecontroller.h:61
SDL_JoystickGetDeviceIndexFromInstanceID
int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id)
Definition: SDL_joystick.c:1899
SDL_GetNextJoystickInstanceID
SDL_JoystickID SDL_GetNextJoystickInstanceID(void)
Definition: SDL_joystick.c:250
SDL_GetDriverAndJoystickIndex
SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, struct _SDL_JoystickDriver **driver, int *driver_index)
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_IsGameControllerNameAndGUID
SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid)
Definition: SDL_gamecontroller.c:1486
SDL_ShouldIgnoreJoystick
SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
Definition: SDL_joystick.c:1698
SDL_JoystickGUID
Definition: SDL_joystick.h:70
state
struct xkb_state * state
Definition: SDL_waylandsym.h:114
button
SDL_Texture * button
Definition: testgamecontroller.c:67
SDL_GetJoystickGUIDInfo
void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version)
Definition: SDL_joystick.c:1337
SDL_GetJoystickGameControllerType
SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
Definition: SDL_joystick.c:1409