World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
SDL_joystick.h
См. документацию.
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 
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 
66 struct _SDL_Joystick;
67 typedef struct _SDL_Joystick SDL_Joystick;
68 
69 /* A structure that encodes the stable unique id for a joystick device */
70 typedef struct {
71  Uint8 data[16];
73 
82 
83 typedef enum
84 {
96 
97 typedef enum
98 {
103  SDL_JOYSTICK_POWER_FULL, /* <= 100% */
107 
108 /* Function prototypes */
109 
120 extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
121 extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
122 
126 extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
127 
133 extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
134 
139 extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
140 
145 extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
146 
152 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
153 
159 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
160 
166 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
167 
172 extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
173 
179 extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
180 
190 extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
191 
195 extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id);
196 
200 extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
201 
206 extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
207 
213 extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
214 
218 extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index);
219 
223 extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
224 
229 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
230 
235 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
236 
241 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
242 
246 extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick);
247 
252 extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
253 
257 extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
258 
262 extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
263 
267 extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
268 
272 extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
273 
280 extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick);
281 
285 extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick);
286 
290 extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
291 
298 extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
299 
309 extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
310 
311 #define SDL_JOYSTICK_AXIS_MAX 32767
312 #define SDL_JOYSTICK_AXIS_MIN -32768
313 
320 extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
321  int axis);
322 
332 extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
333  int axis, Sint16 *state);
334 
338 /* @{ */
339 #define SDL_HAT_CENTERED 0x00
340 #define SDL_HAT_UP 0x01
341 #define SDL_HAT_RIGHT 0x02
342 #define SDL_HAT_DOWN 0x04
343 #define SDL_HAT_LEFT 0x08
344 #define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
345 #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
346 #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
347 #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
348 /* @} */
349 
366 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
367  int hat);
368 
376 extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
377  int ball, int *dx, int *dy);
378 
384 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
385  int button);
386 
398 extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
399 
403 extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
404 
408 extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
409 
410 /* Ends C function definitions when using C++ */
411 #ifdef __cplusplus
412 }
413 #endif
414 #include "close_code.h"
415 
416 #endif /* SDL_joystick_h_ */
417 
418 /* vi: set ts=4 sw=4 expandtab: */
SDL_JOYSTICK_TYPE_GAMECONTROLLER
@ SDL_JOYSTICK_TYPE_GAMECONTROLLER
Definition: SDL_joystick.h:86
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_JoystickGetDeviceInstanceID
DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index)
SDL_JoystickGetType
DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joystick)
SDL_JoystickGetGUIDString
DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID)
Sint32
int32_t Sint32
Definition: SDL_stdinc.h:197
SDL_JoystickGetVendor
DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick)
SDL_JOYSTICK_POWER_MAX
@ SDL_JOYSTICK_POWER_MAX
Definition: SDL_joystick.h:105
SDL_JoystickOpen
DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index)
SDL_error.h
SDL_NumJoysticks
DECLSPEC int SDLCALL SDL_NumJoysticks(void)
SDL_JoystickGetDeviceVendor
DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index)
SDL_JoystickPowerLevel
SDL_JoystickPowerLevel
Definition: SDL_joystick.h:97
SDL_Joystick
struct _SDL_Joystick SDL_Joystick
Definition: SDL_joystick.h:67
SDL_JoystickGetDeviceProductVersion
DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index)
SDL_JOYSTICK_POWER_LOW
@ SDL_JOYSTICK_POWER_LOW
Definition: SDL_joystick.h:101
SDL_JoystickGetDeviceProduct
DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index)
SDL_JOYSTICK_TYPE_GUITAR
@ SDL_JOYSTICK_TYPE_GUITAR
Definition: SDL_joystick.h:91
SDL_JoystickGetProduct
DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick)
SDL_JoystickNumHats
DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick)
SDL_JOYSTICK_POWER_EMPTY
@ SDL_JOYSTICK_POWER_EMPTY
Definition: SDL_joystick.h:100
SDL_JoystickGetGUID
DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joystick)
SDL_JoystickFromInstanceID
DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id)
SDL_JoystickCurrentPowerLevel
DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick)
close_code.h
SDL_JOYSTICK_TYPE_DANCE_PAD
@ SDL_JOYSTICK_TYPE_DANCE_PAD
Definition: SDL_joystick.h:90
SDL_JoystickGetBall
DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
begin_code.h
SDL_JoystickGetProductVersion
DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick)
SDL_JOYSTICK_TYPE_DRUM_KIT
@ SDL_JOYSTICK_TYPE_DRUM_KIT
Definition: SDL_joystick.h:92
SDL_JoystickRumble
DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
Sint16
int16_t Sint16
Definition: SDL_stdinc.h:185
SDL_JOYSTICK_POWER_MEDIUM
@ SDL_JOYSTICK_POWER_MEDIUM
Definition: SDL_joystick.h:102
SDL_JOYSTICK_POWER_UNKNOWN
@ SDL_JOYSTICK_POWER_UNKNOWN
Definition: SDL_joystick.h:99
SDL_JOYSTICK_TYPE_FLIGHT_STICK
@ SDL_JOYSTICK_TYPE_FLIGHT_STICK
Definition: SDL_joystick.h:89
SDL_JOYSTICK_POWER_WIRED
@ SDL_JOYSTICK_POWER_WIRED
Definition: SDL_joystick.h:104
SDL_LockJoysticks
DECLSPEC void SDLCALL SDL_LockJoysticks(void)
SDL_JOYSTICK_TYPE_THROTTLE
@ SDL_JOYSTICK_TYPE_THROTTLE
Definition: SDL_joystick.h:94
SDL_JoystickClose
DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick)
SDL_JoystickInstanceID
DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joystick)
SDL_JoystickGetDeviceGUID
DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index)
SDL_JoystickGetAxis
DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
SDL_JoystickSetPlayerIndex
DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index)
SDL_JoystickGetPlayerIndex
DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick)
SDL_JoystickGetGUIDFromString
DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID)
SDL_JoystickGetHat
DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat)
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161
SDL_JoystickNumAxes
DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick)
SDL_JoystickEventState
DECLSPEC int SDLCALL SDL_JoystickEventState(int state)
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_stdinc.h
SDL_JOYSTICK_POWER_FULL
@ SDL_JOYSTICK_POWER_FULL
Definition: SDL_joystick.h:103
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_JOYSTICK_TYPE_ARCADE_PAD
@ SDL_JOYSTICK_TYPE_ARCADE_PAD
Definition: SDL_joystick.h:93
SDL_JoystickGetAttached
DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick)
SDL_UnlockJoysticks
DECLSPEC void SDLCALL SDL_UnlockJoysticks(void)
SDL_JoystickName
const DECLSPEC char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick)
SDL_JoystickNumBalls
DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick)
SDL_JoystickNameForIndex
const DECLSPEC char *SDLCALL SDL_JoystickNameForIndex(int device_index)
SDL_JoystickNumButtons
DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick)
SDL_JoystickGUID
Definition: SDL_joystick.h:70
SDL_JoystickGetButton
DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button)
SDL_JoystickGetAxisInitialState
DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state)
SDL_JOYSTICK_TYPE_WHEEL
@ SDL_JOYSTICK_TYPE_WHEEL
Definition: SDL_joystick.h:87
SDL_JoystickFromPlayerIndex
DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index)
SDL_JoystickUpdate
DECLSPEC void SDLCALL SDL_JoystickUpdate(void)
SDL_JOYSTICK_TYPE_UNKNOWN
@ SDL_JOYSTICK_TYPE_UNKNOWN
Definition: SDL_joystick.h:85
SDL_JoystickGetDevicePlayerIndex
DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index)
SDL_JoystickType
SDL_JoystickType
Definition: SDL_joystick.h:83
SDL_JoystickID
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:81
SDL_JOYSTICK_TYPE_ARCADE_STICK
@ SDL_JOYSTICK_TYPE_ARCADE_STICK
Definition: SDL_joystick.h:88
SDL_JoystickGetDeviceType
DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index)