zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_joystick.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 
39 #ifndef _SDL_joystick_h
40 #define _SDL_joystick_h
41 
42 #include "SDL_stdinc.h"
43 #include "SDL_error.h"
44 
45 #include "begin_code.h"
46 /* Set up for C function definitions, even when using C++ */
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
63 /* The joystick structure used to identify an SDL joystick */
64 struct _SDL_Joystick;
65 typedef struct _SDL_Joystick SDL_Joystick;
66 
67 /* A structure that encodes the stable unique id for a joystick device */
68 typedef struct {
69  Uint8 data[16];
71 
73 
74 
75 /* Function prototypes */
79 extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
80 
86 extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
87 
96 extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
97 
102 extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
103 
108 
113 
118 extern DECLSPEC void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
119 
124 
129 
133 extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
134 
138 extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
139 
146 extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick);
147 
151 extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick);
152 
156 extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
157 
164 extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
165 
175 extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
176 
185  int axis);
186 
190 /* @{ */
191 #define SDL_HAT_CENTERED 0x00
192 #define SDL_HAT_UP 0x01
193 #define SDL_HAT_RIGHT 0x02
194 #define SDL_HAT_DOWN 0x04
195 #define SDL_HAT_LEFT 0x08
196 #define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
197 #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
198 #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
199 #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
200 /* @} */
201 
219  int hat);
220 
228 extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
229  int ball, int *dx, int *dy);
230 
237  int button);
238 
242 extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
243 
244 
245 /* Ends C function definitions when using C++ */
246 #ifdef __cplusplus
247 }
248 #endif
249 #include "close_code.h"
250 
251 #endif /* _SDL_joystick_h */
252 
253 /* vi: set ts=4 sw=4 expandtab: */
DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index)
Definition: SDL_joystick.c:84
DECLSPEC void SDLCALL SDL_JoystickUpdate(void)
Definition: SDL_joystick.c:657
DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick)
Definition: SDL_joystick.c:246
int32_t Sint32
A signed 32-bit integer type.
Definition: SDL_stdinc.h:141
DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joystick)
Definition: SDL_joystick.c:372
SDL_bool
Definition: SDL_stdinc.h:116
DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick)
Definition: SDL_joystick.c:359
DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick)
Definition: SDL_joystick.c:398
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:72
DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index)
Definition: SDL_joystick.c:752
DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID)
Definition: SDL_joystick.c:824
#define DECLSPEC
Definition: begin_code.h:62
DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
Definition: SDL_joystick.c:270
#define SDLCALL
Definition: begin_code.h:72
DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button)
Definition: SDL_joystick.c:338
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
Definition: SDL_joystick.c:310
DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick)
Definition: SDL_joystick.c:258
DECLSPEC int SDLCALL SDL_JoystickEventState(int state)
Definition: SDL_joystick.c:708
DECLSPEC void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID)
Definition: SDL_joystick.c:770
DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick)
Definition: SDL_joystick.c:385
DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joystick)
Definition: SDL_joystick.c:764
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick)
Definition: SDL_joystick.c:234
int16_t Sint16
A signed 16-bit integer type.
Definition: SDL_stdinc.h:133
DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index)
Definition: SDL_joystick.c:101
DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick)
Definition: SDL_joystick.c:222
DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat)
Definition: SDL_joystick.c:290
DECLSPEC int SDLCALL SDL_NumJoysticks(void)
Definition: SDL_joystick.c:75