zenilib: zenilib/jni/external/sdl/src/joystick/SDL_sysjoystick.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_sysjoystick.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 #include "SDL_config.h"
22
23 /* This is the system specific header for the SDL joystick API */
24
25 #include "SDL_joystick.h"
26 #include "SDL_joystick_c.h"
27
28 /* The SDL joystick structure */
29 struct _SDL_Joystick
30 {
31 SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */
32 char *name; /* Joystick name - system dependent */
33
34 int naxes; /* Number of axis controls on the joystick */
35 Sint16 *axes; /* Current axis states */
36
37 int nhats; /* Number of hats on the joystick */
38 Uint8 *hats; /* Current hat states */
39
40 int nballs; /* Number of trackballs on the joystick */
41 struct balldelta {
42 int dx;
43 int dy;
44 } *balls; /* Current ball motion deltas */
45
46 int nbuttons; /* Number of buttons on the joystick */
47 Uint8 *buttons; /* Current button states */
48
49 struct joystick_hwdata *hwdata; /* Driver dependent information */
50
51 int ref_count; /* Reference count for multiple opens */
52
53 Uint8 closed; /* 1 if this device is no longer valid */
54 Uint8 uncentered; /* 1 if this device needs to have its state reset to 0 */
55 struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */
56 };
57
58 /* Function to scan the system for joysticks.
59 * Joystick 0 should be the system default joystick.
60 * This function should return the number of available joysticks, or -1
61 * on an unrecoverable fatal error.
62 */
63 extern int SDL_SYS_JoystickInit(void);
64
65 /* Function to return the number of joystick devices plugged in right now */
66 extern int SDL_SYS_NumJoysticks();
67
68 /* Function to cause any queued joystick insertions to be processed */
69 extern void SDL_SYS_JoystickDetect();
70
71 /* Function to determine if the joystick loop needs to run right now */
72 extern SDL_bool SDL_SYS_JoystickNeedsPolling();
73
74 /* Function to get the device-dependent name of a joystick */
75 extern const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index);
76
77 /* Function to get the current instance id of the joystick located at device_index */
78 extern SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index);
79
80 /* Function to open a joystick for use.
81 The joystick to open is specified by the index field of the joystick.
82 This should fill the nbuttons and naxes fields of the joystick structure.
83 It returns 0, or -1 if there is an error.
84 */
85 extern int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index);
86
87 /* Function to query if the joystick is currently attached
88 * It returns 1 if attached, 0 otherwise.
89 */
90 extern SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick * joystick);
91
92 /* Function to update the state of a joystick - called as a device poll.
93 * This function shouldn't update the joystick structure directly,
94 * but instead should call SDL_PrivateJoystick*() to deliver events
95 * and update joystick device state.
96 */
97 extern void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick);
98
99 /* Function to close a joystick after use */
100 extern void SDL_SYS_JoystickClose(SDL_Joystick * joystick);
101
102 /* Function to perform any system-specific joystick related cleanup */
103 extern void SDL_SYS_JoystickQuit(void);
104
105 /* Function to return the stable GUID for a plugged in device */
106 extern SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index);
107
108 /* Function to return the stable GUID for a opened joystick */
109 extern SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick);
110
111 #ifdef SDL_JOYSTICK_DINPUT
112 /* Function to get the current instance id of the joystick located at device_index */
113 extern SDL_bool SDL_SYS_IsXInputDeviceIndex( int device_index );
114 extern SDL_bool SDL_SYS_IsXInputJoystick(SDL_Joystick * joystick);
115 #endif
116
117 /* vi: set ts=4 sw=4 expandtab: */
_SDL_Joystick::balldelta::dy
int dy
Definition: SDL_sysjoystick.h:43
SDL_joystick.h
SDL_SYS_NumJoysticks
int SDL_SYS_NumJoysticks()
Definition: SDL_sysjoystick.m:43
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:116
_SDL_Joystick::next
struct _SDL_Joystick * next
Definition: SDL_sysjoystick.h:55
SDL_JoystickID
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:72
_SDL_Joystick::axes
Sint16 * axes
Definition: SDL_sysjoystick.h:35
SDL_SYS_JoystickQuit
void SDL_SYS_JoystickQuit(void)
Definition: SDL_sysjoystick.m:129
_SDL_Joystick::buttons
Uint8 * buttons
Definition: SDL_sysjoystick.h:47
_SDL_Joystick::hats
Uint8 * hats
Definition: SDL_sysjoystick.h:38
SDL_config.h
_SDL_Joystick::hwdata
struct joystick_hwdata * hwdata
Definition: SDL_sysjoystick.h:49
_SDL_Joystick::nballs
int nballs
Definition: SDL_sysjoystick.h:40
joystick_hwdata
Definition: SDL_sysjoystick_c.h:58
_SDL_Joystick::balldelta
Definition: SDL_sysjoystick.h:41
_SDL_Joystick::balls
struct _SDL_Joystick::balldelta * balls
_SDL_Joystick::uncentered
Uint8 uncentered
Definition: SDL_sysjoystick.h:54
SDL_SYS_JoystickAttached
SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
Definition: SDL_sysjoystick.m:87
SDL_SYS_JoystickDetect
void SDL_SYS_JoystickDetect()
Definition: SDL_sysjoystick.m:48
SDL_SYS_JoystickNameForDeviceIndex
const char * SDL_SYS_JoystickNameForDeviceIndex(int device_index)
Definition: SDL_sysjoystick.m:59
SDL_joystick_c.h
SDL_SYS_JoystickUpdate
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
Definition: SDL_sysjoystick.m:98
SDL_SYS_JoystickGetGUID
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick *joystick)
Definition: SDL_sysjoystick.m:143
SDL_SYS_JoystickNeedsPolling
SDL_bool SDL_SYS_JoystickNeedsPolling()
Definition: SDL_sysjoystick.m:52
SDL_SYS_JoystickInit
int SDL_SYS_JoystickInit(void)
Definition: SDL_sysjoystick.m:38
_SDL_Joystick::name
char * name
Definition: SDL_sysjoystick.h:32
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
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_SYS_GetInstanceIdOfDeviceIndex
SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
Definition: SDL_sysjoystick.m:65
SDL_SYS_JoystickOpen
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick, int device_index)
Definition: SDL_sysjoystick.m:76
_SDL_Joystick::nbuttons
int nbuttons
Definition: SDL_sysjoystick.h:46
_SDL_Joystick::closed
Uint8 closed
Definition: SDL_sysjoystick.h:53
SDL_SYS_JoystickClose
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
Definition: SDL_sysjoystick.m:119
_SDL_Joystick::ref_count
int ref_count
Definition: SDL_sysjoystick.h:51
_SDL_Joystick::naxes
int naxes
Definition: SDL_sysjoystick.h:34
_SDL_Joystick::instance_id
SDL_JoystickID instance_id
Definition: SDL_sysjoystick.h:31
SDL_SYS_JoystickGetDeviceGUID
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index)
Definition: SDL_sysjoystick.m:133
_SDL_Joystick::nhats
int nhats
Definition: SDL_sysjoystick.h:37
_SDL_Joystick::balldelta::dx
int dx
Definition: SDL_sysjoystick.h:42