arsa  2.7
SDL_gamecontroller.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 
28 #ifndef SDL_gamecontroller_h_
29 #define SDL_gamecontroller_h_
30 
31 #include "SDL_stdinc.h"
32 #include "SDL_error.h"
33 #include "SDL_rwops.h"
34 #include "SDL_joystick.h"
35 
36 #include "begin_code.h"
37 /* Set up for C function definitions, even when using C++ */
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
57 struct _SDL_GameController;
58 typedef struct _SDL_GameController SDL_GameController;
59 
60 
61 typedef enum
62 {
68 
73 {
75  union
76  {
77  int button;
78  int axis;
79  struct {
80  int hat;
81  int hat_mask;
82  } hat;
83  } value;
84 
86 
87 
123 
129 #define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
130 
136 extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
137 
144 
150 extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
151 
158 
164 extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller);
165 
169 extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
170 
176 extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
177 
184 extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index);
185 
195 extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
196 
201 
205 extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
206 
213 
219 
225 
231 
237 
242 
252 extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
253 
260 extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
261 
262 
272 typedef enum
273 {
283 
288 
293 
300 
309 extern DECLSPEC Sint16 SDLCALL
312 
316 typedef enum
317 {
336 
341 
346 
352  SDL_GameControllerButton button);
353 
354 
361  SDL_GameControllerButton button);
362 
374 extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
375 
379 extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
380 
381 
382 /* Ends C function definitions when using C++ */
383 #ifdef __cplusplus
384 }
385 #endif
386 #include "close_code.h"
387 
388 #endif /* SDL_gamecontroller_h_ */
389 
390 /* vi: set ts=4 sw=4 expandtab: */
DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller)
DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller)
DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller)
SDL_GameControllerBindType
DECLSPEC void SDLCALL SDL_GameControllerUpdate(void)
DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString)
struct _SDL_GameController SDL_GameController
SDL_bool
Definition: SDL_stdinc.h:161
DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index)
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:81
#define DECLSPEC
Definition: begin_code.h:74
DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index)
DECLSPEC int SDLCALL SDL_GameControllerEventState(int state)
uint32_t Uint32
Definition: SDL_stdinc.h:203
#define SDLCALL
Definition: begin_code.h:89
SDL_GameControllerButton
DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index)
DECLSPEC const char *SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button)
struct _SDL_Joystick SDL_Joystick
Definition: SDL_joystick.h:67
DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString)
uint16_t Uint16
Definition: SDL_stdinc.h:191
DECLSPEC const char *SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis)
SDL_GameControllerBindType bindType
DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index)
DECLSPEC Sint16 SDLCALL SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
DECLSPEC char *SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller)
DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void)
union SDL_GameControllerButtonBind::@15 value
DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, int freerw)
DECLSPEC char *SDLCALL SDL_GameControllerMappingForIndex(int mapping_index)
DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller)
DECLSPEC char *SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid)
DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char *mappingString)
uint8_t Uint8
Definition: SDL_stdinc.h:179
struct SDL_GameControllerButtonBind SDL_GameControllerButtonBind
DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller)
DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
SDL_GameControllerAxis
DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller)
int16_t Sint16
Definition: SDL_stdinc.h:185
DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller)
DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller)