zenilib: zenilib/jni/external/sdl/SDL/SDL_gamecontroller.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_gamecontroller.h
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 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_joystick.h"
34
35 #include "begin_code.h"
36 /* Set up for C function definitions, even when using C++ */
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
53 /* The gamecontroller structure used to identify an SDL game controller */
54 struct _SDL_GameController;
55 typedef struct _SDL_GameController SDL_GameController;
56
57
58 typedef enum
59 {
60 SDL_CONTROLLER_BINDTYPE_NONE = 0,
61 SDL_CONTROLLER_BINDTYPE_BUTTON,
62 SDL_CONTROLLER_BINDTYPE_AXIS,
63 SDL_CONTROLLER_BINDTYPE_HAT
64 } SDL_GameControllerBindType;
65
69 typedef struct SDL_GameControllerButtonBind
70 {
71 SDL_GameControllerBindType bindType;
72 union
73 {
74 int button;
75 int axis;
76 struct {
77 int hat;
78 int hat_mask;
79 } hat;
80 } value;
81
82 } SDL_GameControllerButtonBind;
83
84
116 extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
117
123 extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid );
124
130 extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller );
131
135 extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
136
137
143 extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
144
153 extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
154
158 extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
159
164 extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
165
169 extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
170
180 extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
181
188 extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
189
190
194 typedef enum
195 {
196 SDL_CONTROLLER_AXIS_INVALID = -1,
197 SDL_CONTROLLER_AXIS_LEFTX,
198 SDL_CONTROLLER_AXIS_LEFTY,
199 SDL_CONTROLLER_AXIS_RIGHTX,
200 SDL_CONTROLLER_AXIS_RIGHTY,
201 SDL_CONTROLLER_AXIS_TRIGGERLEFT,
202 SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
203 SDL_CONTROLLER_AXIS_MAX
204 } SDL_GameControllerAxis;
205
209 extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
210
214 extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
215
219 extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
220 SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
221 SDL_GameControllerAxis axis);
222
230 extern DECLSPEC Sint16 SDLCALL
231 SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
232 SDL_GameControllerAxis axis);
233
237 typedef enum
238 {
239 SDL_CONTROLLER_BUTTON_INVALID = -1,
240 SDL_CONTROLLER_BUTTON_A,
241 SDL_CONTROLLER_BUTTON_B,
242 SDL_CONTROLLER_BUTTON_X,
243 SDL_CONTROLLER_BUTTON_Y,
244 SDL_CONTROLLER_BUTTON_BACK,
245 SDL_CONTROLLER_BUTTON_GUIDE,
246 SDL_CONTROLLER_BUTTON_START,
247 SDL_CONTROLLER_BUTTON_LEFTSTICK,
248 SDL_CONTROLLER_BUTTON_RIGHTSTICK,
249 SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
250 SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
251 SDL_CONTROLLER_BUTTON_DPAD_UP,
252 SDL_CONTROLLER_BUTTON_DPAD_DOWN,
253 SDL_CONTROLLER_BUTTON_DPAD_LEFT,
254 SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
255 SDL_CONTROLLER_BUTTON_MAX
256 } SDL_GameControllerButton;
257
261 extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
262
266 extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
267
271 extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
272 SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
273 SDL_GameControllerButton button);
274
275
281 extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
282 SDL_GameControllerButton button);
283
287 extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
288
289
290 /* Ends C function definitions when using C++ */
291 #ifdef __cplusplus
292 }
293 #endif
294 #include "close_code.h"
295
296 #endif /* _SDL_gamecontroller_h */
297
298 /* vi: set ts=4 sw=4 expandtab: */
SDL_CONTROLLER_AXIS_LEFTY
Definition: SDL_gamecontroller.h:198
SDL_CONTROLLER_BUTTON_INVALID
Definition: SDL_gamecontroller.h:239
SDL_CONTROLLER_AXIS_RIGHTY
Definition: SDL_gamecontroller.h:200
SDL_GameControllerClose
DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller)
Definition: SDL_gamecontroller.c:1086
SDL_GameControllerButtonBind::button
int button
Definition: SDL_gamecontroller.h:74
SDL_GameControllerBindType
SDL_GameControllerBindType
Definition: SDL_gamecontroller.h:58
SDL_joystick.h
SDL_GameControllerUpdate
DECLSPEC void SDLCALL SDL_GameControllerUpdate(void)
Definition: SDL_gamecontroller.c:910
SDL_GameControllerGetAxisFromString
DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString)
Definition: SDL_gamecontroller.c:309
SDL_CONTROLLER_BUTTON_BACK
Definition: SDL_gamecontroller.h:244
SDL_GameController
struct _SDL_GameController SDL_GameController
Definition: SDL_gamecontroller.h:55
SDL_CONTROLLER_BUTTON_GUIDE
Definition: SDL_gamecontroller.h:245
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:116
SDL_CONTROLLER_BUTTON_A
Definition: SDL_gamecontroller.h:240
SDL_GameControllerOpen
DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index)
Definition: SDL_gamecontroller.c:849
SDL_CONTROLLER_BUTTON_DPAD_RIGHT
Definition: SDL_gamecontroller.h:254
SDL_CONTROLLER_BUTTON_B
Definition: SDL_gamecontroller.h:241
SDL_GameControllerButtonBind
Definition: SDL_gamecontroller.h:69
SDL_CONTROLLER_BINDTYPE_BUTTON
Definition: SDL_gamecontroller.h:61
DECLSPEC
#define DECLSPEC
Definition: begin_code.h:62
SDL_GameControllerButtonBind::value
union SDL_GameControllerButtonBind::@64 value
SDL_GameControllerNameForIndex
DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index)
Definition: SDL_gamecontroller.c:815
SDL_GameControllerEventState
DECLSPEC int SDLCALL SDL_GameControllerEventState(int state)
Definition: SDL_gamecontroller.c:1218
SDL_CONTROLLER_AXIS_MAX
Definition: SDL_gamecontroller.h:203
SDLCALL
#define SDLCALL
Definition: begin_code.h:72
SDL_GameControllerButton
SDL_GameControllerButton
Definition: SDL_gamecontroller.h:237
begin_code.h
SDL_GameControllerGetBindForButton
DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
Definition: SDL_gamecontroller.c:1053
SDL_CONTROLLER_BUTTON_START
Definition: SDL_gamecontroller.h:246
SDL_IsGameController
DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index)
Definition: SDL_gamecontroller.c:830
SDL_GameControllerGetStringForButton
DECLSPEC const char *SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button)
Definition: SDL_gamecontroller.c:374
SDL_CONTROLLER_BUTTON_RIGHTSTICK
Definition: SDL_gamecontroller.h:248
SDL_GameControllerGetButtonFromString
DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString)
Definition: SDL_gamecontroller.c:357
SDL_GameControllerGetStringForAxis
DECLSPEC const char *SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis)
Definition: SDL_gamecontroller.c:326
close_code.h
SDL_CONTROLLER_BUTTON_LEFTSHOULDER
Definition: SDL_gamecontroller.h:249
SDL_CONTROLLER_AXIS_LEFTX
Definition: SDL_gamecontroller.h:197
SDL_GameControllerButtonBind::bindType
SDL_GameControllerBindType bindType
Definition: SDL_gamecontroller.h:71
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER
Definition: SDL_gamecontroller.h:250
SDL_stdinc.h
SDL_GameControllerGetAxis
DECLSPEC Sint16 SDLCALL SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
Definition: SDL_gamecontroller.c:921
SDL_CONTROLLER_BUTTON_MAX
Definition: SDL_gamecontroller.h:255
SDL_GameControllerGetBindForAxis
DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
Definition: SDL_gamecontroller.c:1027
SDL_CONTROLLER_AXIS_INVALID
Definition: SDL_gamecontroller.h:196
SDL_GameControllerMapping
DECLSPEC char *SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller)
Definition: SDL_gamecontroller.c:751
SDL_CONTROLLER_BUTTON_DPAD_UP
Definition: SDL_gamecontroller.h:251
SDL_CONTROLLER_AXIS_TRIGGERRIGHT
Definition: SDL_gamecontroller.h:202
SDL_CONTROLLER_AXIS_TRIGGERLEFT
Definition: SDL_gamecontroller.h:201
SDL_CONTROLLER_BUTTON_X
Definition: SDL_gamecontroller.h:242
SDL_GameControllerButtonBind::axis
int axis
Definition: SDL_gamecontroller.h:75
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
SDL_GameControllerGetAttached
DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller)
Definition: SDL_gamecontroller.c:991
SDL_GameControllerMappingForGUID
DECLSPEC char *SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid)
Definition: SDL_gamecontroller.c:731
SDL_JoystickGUID
Definition: SDL_joystick.h:68
Sint16
int16_t Sint16
A signed 16-bit integer type.
Definition: SDL_stdinc.h:133
_SDL_Joystick
Definition: SDL_sysjoystick.h:29
SDL_CONTROLLER_AXIS_RIGHTX
Definition: SDL_gamecontroller.h:199
SDL_CONTROLLER_BINDTYPE_HAT
Definition: SDL_gamecontroller.h:63
SDL_GameControllerButtonBind::hat_mask
int hat_mask
Definition: SDL_gamecontroller.h:78
SDL_CONTROLLER_BINDTYPE_AXIS
Definition: SDL_gamecontroller.h:62
SDL_GameControllerAddMapping
DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char *mappingString)
Definition: SDL_gamecontroller.c:662
SDL_CONTROLLER_BUTTON_DPAD_LEFT
Definition: SDL_gamecontroller.h:253
SDL_GameControllerButtonBind::hat
int hat
Definition: SDL_gamecontroller.h:77
SDL_GameControllerButtonBind
struct SDL_GameControllerButtonBind SDL_GameControllerButtonBind
SDL_CONTROLLER_BUTTON_Y
Definition: SDL_gamecontroller.h:243
SDL_error.h
SDL_GameControllerGetJoystick
DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller)
Definition: SDL_gamecontroller.c:1016
SDL_CONTROLLER_BUTTON_LEFTSTICK
Definition: SDL_gamecontroller.h:247
SDL_GameControllerGetButton
DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
Definition: SDL_gamecontroller.c:956
SDL_GameControllerAxis
SDL_GameControllerAxis
Definition: SDL_gamecontroller.h:194
SDL_CONTROLLER_BINDTYPE_NONE
Definition: SDL_gamecontroller.h:60
SDL_CONTROLLER_BUTTON_DPAD_DOWN
Definition: SDL_gamecontroller.h:252
SDL_GameControllerName
DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller)
Definition: SDL_gamecontroller.c:1004