World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
SDL_gamecontroller.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 
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 typedef enum
61 {
69 
70 typedef enum
71 {
77 
82 {
84  union
85  {
86  int button;
87  int axis;
88  struct {
89  int hat;
90  int hat_mask;
91  } hat;
92  } value;
93 
95 
96 
131 extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
132 
138 #define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
139 
145 extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
146 
152 extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
153 
159 extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
160 
166 extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid);
167 
173 extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller);
174 
178 extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
179 
185 extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
186 
191 extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
192 
199 extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index);
200 
210 extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
211 
216 
220 extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index);
221 
225 extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
226 
230 extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
231 
237 extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
238 
242 extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
243 
248 extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
249 
254 extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
255 
260 extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
261 
266 extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
267 
271 extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
272 
282 extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
283 
290 extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
291 
292 
302 typedef enum
303 {
313 
317 extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
318 
322 extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
323 
327 extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
330 
339 extern DECLSPEC Sint16 SDLCALL
342 
346 typedef enum
347 {
366 
370 extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
371 
375 extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
376 
380 extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
382  SDL_GameControllerButton button);
383 
384 
390 extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
391  SDL_GameControllerButton button);
392 
404 extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
405 
409 extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
410 
411 
412 /* Ends C function definitions when using C++ */
413 #ifdef __cplusplus
414 }
415 #endif
416 #include "close_code.h"
417 
418 #endif /* SDL_gamecontroller_h_ */
419 
420 /* vi: set ts=4 sw=4 expandtab: */
SDL_GameControllerGetBindForAxis
DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
SDL_CONTROLLER_BUTTON_DPAD_LEFT
@ SDL_CONTROLLER_BUTTON_DPAD_LEFT
Definition: SDL_gamecontroller.h:362
SDL_GameControllerClose
DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller)
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_GameControllerAddMappingsFromRW
DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, int freerw)
SDL_GameControllerButtonBind
struct SDL_GameControllerButtonBind SDL_GameControllerButtonBind
SDL_CONTROLLER_AXIS_RIGHTX
@ SDL_CONTROLLER_AXIS_RIGHTX
Definition: SDL_gamecontroller.h:307
SDL_GameControllerButtonBind::button
int button
Definition: SDL_gamecontroller.h:86
SDL_GameControllerGetPlayerIndex
DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller)
SDL_GameControllerButtonBind::hat
int hat
Definition: SDL_gamecontroller.h:89
SDL_GameControllerOpen
DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index)
SDL_GameControllerAddMapping
DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char *mappingString)
SDL_CONTROLLER_BUTTON_INVALID
@ SDL_CONTROLLER_BUTTON_INVALID
Definition: SDL_gamecontroller.h:348
SDL_joystick.h
SDL_IsGameController
DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index)
SDL_error.h
SDL_GameControllerButtonBind::bindType
SDL_GameControllerBindType bindType
Definition: SDL_gamecontroller.h:83
SDL_CONTROLLER_BINDTYPE_NONE
@ SDL_CONTROLLER_BINDTYPE_NONE
Definition: SDL_gamecontroller.h:72
SDL_CONTROLLER_TYPE_UNKNOWN
@ SDL_CONTROLLER_TYPE_UNKNOWN
Definition: SDL_gamecontroller.h:62
SDL_GameControllerMapping
DECLSPEC char *SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller)
SDL_GameControllerMappingForIndex
DECLSPEC char *SDLCALL SDL_GameControllerMappingForIndex(int mapping_index)
SDL_GameController
struct _SDL_GameController SDL_GameController
Definition: SDL_gamecontroller.h:58
SDL_Joystick
struct _SDL_Joystick SDL_Joystick
Definition: SDL_joystick.h:67
SDL_CONTROLLER_BUTTON_RIGHTSTICK
@ SDL_CONTROLLER_BUTTON_RIGHTSTICK
Definition: SDL_gamecontroller.h:357
SDL_GameControllerGetProductVersion
DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller)
SDL_GameControllerButtonBind
Definition: SDL_gamecontroller.h:81
SDL_CONTROLLER_AXIS_LEFTX
@ SDL_CONTROLLER_AXIS_LEFTX
Definition: SDL_gamecontroller.h:305
SDL_GameControllerNumMappings
DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void)
SDL_GameControllerName
const DECLSPEC char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller)
close_code.h
SDL_CONTROLLER_BUTTON_B
@ SDL_CONTROLLER_BUTTON_B
Definition: SDL_gamecontroller.h:350
SDL_GameControllerButtonBind::hat_mask
int hat_mask
Definition: SDL_gamecontroller.h:90
SDL_CONTROLLER_BUTTON_MAX
@ SDL_CONTROLLER_BUTTON_MAX
Definition: SDL_gamecontroller.h:364
SDL_GameControllerGetStringForButton
const DECLSPEC char *SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button)
SDL_GameControllerMappingForDeviceIndex
DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index)
begin_code.h
SDL_CONTROLLER_BUTTON_BACK
@ SDL_CONTROLLER_BUTTON_BACK
Definition: SDL_gamecontroller.h:353
SDL_CONTROLLER_TYPE_PS3
@ SDL_CONTROLLER_TYPE_PS3
Definition: SDL_gamecontroller.h:65
SDL_CONTROLLER_BINDTYPE_BUTTON
@ SDL_CONTROLLER_BINDTYPE_BUTTON
Definition: SDL_gamecontroller.h:73
SDL_GameControllerFromInstanceID
DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
SDL_CONTROLLER_BUTTON_LEFTSHOULDER
@ SDL_CONTROLLER_BUTTON_LEFTSHOULDER
Definition: SDL_gamecontroller.h:358
SDL_GameControllerEventState
DECLSPEC int SDLCALL SDL_GameControllerEventState(int state)
SDL_GameControllerButtonBind::value
union SDL_GameControllerButtonBind::@91 value
SDL_GameControllerRumble
DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
SDL_GameControllerNameForIndex
const DECLSPEC char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index)
SDL_GameControllerGetButtonFromString
DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString)
Sint16
int16_t Sint16
Definition: SDL_stdinc.h:185
SDL_GameControllerBindType
SDL_GameControllerBindType
Definition: SDL_gamecontroller.h:70
SDL_CONTROLLER_TYPE_PS4
@ SDL_CONTROLLER_TYPE_PS4
Definition: SDL_gamecontroller.h:66
SDL_CONTROLLER_AXIS_TRIGGERLEFT
@ SDL_CONTROLLER_AXIS_TRIGGERLEFT
Definition: SDL_gamecontroller.h:309
SDL_GameControllerGetJoystick
DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller)
SDL_CONTROLLER_AXIS_INVALID
@ SDL_CONTROLLER_AXIS_INVALID
Definition: SDL_gamecontroller.h:304
SDL_GameControllerMappingForGUID
DECLSPEC char *SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid)
SDL_GameControllerGetButton
DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
SDL_CONTROLLER_AXIS_MAX
@ SDL_CONTROLLER_AXIS_MAX
Definition: SDL_gamecontroller.h:311
SDL_GameControllerSetPlayerIndex
DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index)
SDL_GameControllerFromPlayerIndex
DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index)
SDL_GameControllerGetStringForAxis
const DECLSPEC char *SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis)
SDL_GameControllerAxis
SDL_GameControllerAxis
Definition: SDL_gamecontroller.h:302
SDL_GameControllerButtonBind::axis
int axis
Definition: SDL_gamecontroller.h:87
SDL_CONTROLLER_BUTTON_START
@ SDL_CONTROLLER_BUTTON_START
Definition: SDL_gamecontroller.h:355
SDL_GameControllerGetVendor
DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller)
SDL_GameControllerGetType
DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller)
SDL_GameControllerTypeForIndex
DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index)
SDL_GameControllerGetAxis
DECLSPEC Sint16 SDLCALL SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER
@ SDL_CONTROLLER_BUTTON_RIGHTSHOULDER
Definition: SDL_gamecontroller.h:359
SDL_CONTROLLER_BINDTYPE_HAT
@ SDL_CONTROLLER_BINDTYPE_HAT
Definition: SDL_gamecontroller.h:75
SDL_GameControllerGetAttached
DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller)
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161
SDL_CONTROLLER_BUTTON_Y
@ SDL_CONTROLLER_BUTTON_Y
Definition: SDL_gamecontroller.h:352
SDL_CONTROLLER_BINDTYPE_AXIS
@ SDL_CONTROLLER_BINDTYPE_AXIS
Definition: SDL_gamecontroller.h:74
SDL_GameControllerGetAxisFromString
DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString)
SDL_GameControllerType
SDL_GameControllerType
Definition: SDL_gamecontroller.h:60
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_GameControllerGetProduct
DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller)
SDL_stdinc.h
SDL_CONTROLLER_AXIS_LEFTY
@ SDL_CONTROLLER_AXIS_LEFTY
Definition: SDL_gamecontroller.h:306
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_CONTROLLER_BUTTON_LEFTSTICK
@ SDL_CONTROLLER_BUTTON_LEFTSTICK
Definition: SDL_gamecontroller.h:356
SDL_GameControllerGetBindForButton
DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
SDL_CONTROLLER_TYPE_XBOX360
@ SDL_CONTROLLER_TYPE_XBOX360
Definition: SDL_gamecontroller.h:63
SDL_CONTROLLER_BUTTON_DPAD_DOWN
@ SDL_CONTROLLER_BUTTON_DPAD_DOWN
Definition: SDL_gamecontroller.h:361
SDL_CONTROLLER_BUTTON_DPAD_UP
@ SDL_CONTROLLER_BUTTON_DPAD_UP
Definition: SDL_gamecontroller.h:360
SDL_CONTROLLER_AXIS_TRIGGERRIGHT
@ SDL_CONTROLLER_AXIS_TRIGGERRIGHT
Definition: SDL_gamecontroller.h:310
SDL_CONTROLLER_AXIS_RIGHTY
@ SDL_CONTROLLER_AXIS_RIGHTY
Definition: SDL_gamecontroller.h:308
SDL_CONTROLLER_BUTTON_X
@ SDL_CONTROLLER_BUTTON_X
Definition: SDL_gamecontroller.h:351
SDL_JoystickGUID
Definition: SDL_joystick.h:70
SDL_RWops
Definition: SDL_rwops.h:52
SDL_CONTROLLER_BUTTON_A
@ SDL_CONTROLLER_BUTTON_A
Definition: SDL_gamecontroller.h:349
SDL_CONTROLLER_TYPE_XBOXONE
@ SDL_CONTROLLER_TYPE_XBOXONE
Definition: SDL_gamecontroller.h:64
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
@ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
Definition: SDL_gamecontroller.h:67
SDL_CONTROLLER_BUTTON_DPAD_RIGHT
@ SDL_CONTROLLER_BUTTON_DPAD_RIGHT
Definition: SDL_gamecontroller.h:363
SDL_GameControllerUpdate
DECLSPEC void SDLCALL SDL_GameControllerUpdate(void)
SDL_JoystickID
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:81
SDL_rwops.h
SDL_CONTROLLER_BUTTON_GUIDE
@ SDL_CONTROLLER_BUTTON_GUIDE
Definition: SDL_gamecontroller.h:354
SDL_GameControllerButton
SDL_GameControllerButton
Definition: SDL_gamecontroller.h:346