SDL 2.0
SDL_joystick_c.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2019 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_joystick.h"
29
30struct _SDL_JoystickDriver;
31
32/* Initialization and shutdown functions */
33extern int SDL_JoystickInit(void);
34extern void SDL_JoystickQuit(void);
35
36/* Function to get the next available joystick instance ID */
38
39/* Initialization and shutdown functions */
40extern int SDL_GameControllerInitMappings(void);
41extern void SDL_GameControllerQuitMappings(void);
42extern int SDL_GameControllerInit(void);
43extern void SDL_GameControllerQuit(void);
44
45/* Function to get the joystick driver and device index for an API device index */
46extern SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, struct _SDL_JoystickDriver **driver, int *driver_index);
47
48/* Function to return the device index for a joystick ID, or -1 if not found */
50
51/* Function to extract information from an SDL joystick GUID */
52extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version);
53
54/* Function to return whether a joystick is a PS4 controller */
55extern SDL_bool SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id);
56
57/* Function to return whether a joystick is a Nintendo Switch Pro controller */
58extern SDL_bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id);
59
60/* Function to return whether a joystick is a Steam Controller */
61extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id);
62
63/* Function to return whether a joystick is an Xbox 360 controller */
64extern SDL_bool SDL_IsJoystickXbox360(Uint16 vendor_id, Uint16 product_id);
65
66/* Function to return whether a joystick is an Xbox One controller */
67extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id);
68
69/* Function to return whether a joystick guid comes from the XInput driver */
71
72/* Function to return whether a joystick guid comes from the HIDAPI driver */
74
75/* Function to return whether a joystick should be ignored */
77
78/* Function to return whether a joystick name and GUID is a game controller */
80
81/* Function to return whether a game controller should be ignored */
83
84/* Handle delayed guide button on a game controller */
85extern void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick);
86
87/* Internal event queueing functions */
88extern void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance);
89extern void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance);
90extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick,
92extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick,
93 Uint8 ball, Sint16 xrel, Sint16 yrel);
94extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick,
95 Uint8 hat, Uint8 value);
96extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick,
98extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick,
99 SDL_JoystickPowerLevel ePowerLevel);
100
101/* Internal sanity checking functions */
102extern int SDL_PrivateJoystickValid(SDL_Joystick * joystick);
103
104#endif /* SDL_joystick_c_h_ */
105
106/* vi: set ts=4 sw=4 expandtab: */
SDL_JoystickPowerLevel
Definition: SDL_joystick.h:98
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:81
void SDL_GameControllerQuit(void)
int SDL_GameControllerInit(void)
void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick)
void SDL_GameControllerQuitMappings(void)
int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sint16 yrel)
Definition: SDL_joystick.c:930
SDL_bool SDL_IsJoystickXbox360(Uint16 vendor_id, Uint16 product_id)
void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel ePowerLevel)
SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid)
int SDL_PrivateJoystickHat(SDL_Joystick *joystick, Uint8 hat, Uint8 value)
Definition: SDL_joystick.c:890
void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
Definition: SDL_joystick.c:805
int SDL_JoystickInit(void)
Definition: SDL_joystick.c:114
SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid)
int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
Definition: SDL_joystick.c:833
SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
void SDL_JoystickQuit(void)
Definition: SDL_joystick.c:697
SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id)
SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, struct _SDL_JoystickDriver **driver, int *driver_index)
SDL_JoystickID SDL_GetNextJoystickInstanceID(void)
Definition: SDL_joystick.c:163
void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
Definition: SDL_joystick.c:755
void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version)
SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id)
int SDL_PrivateJoystickValid(SDL_Joystick *joystick)
Definition: SDL_joystick.c:394
int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id)
SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id)
int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
Definition: SDL_joystick.c:966
int SDL_GameControllerInitMappings(void)
SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id)
GLuint const GLchar * name
GLsizei const GLfloat * value
SDL_bool
Definition: SDL_stdinc.h:162
int16_t Sint16
Definition: SDL_stdinc.h:185
uint16_t Uint16
Definition: SDL_stdinc.h:191
uint8_t Uint8
Definition: SDL_stdinc.h:179
struct xkb_state * state
SDL_Texture * button
SDL_Texture * axis