comparison src/joystick/SDL_sysjoystick.h @ 1895:c121d94672cb

SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 21:04:37 +0000
parents d910939febfa
children 542c78b6fb12
comparison
equal deleted inserted replaced
1894:c69cee13dd76 1895:c121d94672cb
24 /* This is the system specific header for the SDL joystick API */ 24 /* This is the system specific header for the SDL joystick API */
25 25
26 #include "SDL_joystick.h" 26 #include "SDL_joystick.h"
27 27
28 /* The SDL joystick structure */ 28 /* The SDL joystick structure */
29 struct _SDL_Joystick { 29 struct _SDL_Joystick
30 Uint8 index; /* Device index */ 30 {
31 const char *name; /* Joystick name - system dependent */ 31 Uint8 index; /* Device index */
32 const char *name; /* Joystick name - system dependent */
32 33
33 int naxes; /* Number of axis controls on the joystick */ 34 int naxes; /* Number of axis controls on the joystick */
34 Sint16 *axes; /* Current axis states */ 35 Sint16 *axes; /* Current axis states */
35 36
36 int nhats; /* Number of hats on the joystick */ 37 int nhats; /* Number of hats on the joystick */
37 Uint8 *hats; /* Current hat states */ 38 Uint8 *hats; /* Current hat states */
38
39 int nballs; /* Number of trackballs on the joystick */
40 struct balldelta {
41 int dx;
42 int dy;
43 } *balls; /* Current ball motion deltas */
44
45 int nbuttons; /* Number of buttons on the joystick */
46 Uint8 *buttons; /* Current button states */
47
48 struct joystick_hwdata *hwdata; /* Driver dependent information */
49 39
50 int ref_count; /* Reference count for multiple opens */ 40 int nballs; /* Number of trackballs on the joystick */
41 struct balldelta
42 {
43 int dx;
44 int dy;
45 } *balls; /* Current ball motion deltas */
46
47 int nbuttons; /* Number of buttons on the joystick */
48 Uint8 *buttons; /* Current button states */
49
50 struct joystick_hwdata *hwdata; /* Driver dependent information */
51
52 int ref_count; /* Reference count for multiple opens */
51 }; 53 };
52 54
53 /* Function to scan the system for joysticks. 55 /* Function to scan the system for joysticks.
54 * Joystick 0 should be the system default joystick. 56 * Joystick 0 should be the system default joystick.
55 * This function should return the number of available joysticks, or -1 57 * This function should return the number of available joysticks, or -1
63 /* Function to open a joystick for use. 65 /* Function to open a joystick for use.
64 The joystick to open is specified by the index field of the joystick. 66 The joystick to open is specified by the index field of the joystick.
65 This should fill the nbuttons and naxes fields of the joystick structure. 67 This should fill the nbuttons and naxes fields of the joystick structure.
66 It returns 0, or -1 if there is an error. 68 It returns 0, or -1 if there is an error.
67 */ 69 */
68 extern int SDL_SYS_JoystickOpen(SDL_Joystick *joystick); 70 extern int SDL_SYS_JoystickOpen(SDL_Joystick * joystick);
69 71
70 /* Function to update the state of a joystick - called as a device poll. 72 /* Function to update the state of a joystick - called as a device poll.
71 * This function shouldn't update the joystick structure directly, 73 * This function shouldn't update the joystick structure directly,
72 * but instead should call SDL_PrivateJoystick*() to deliver events 74 * but instead should call SDL_PrivateJoystick*() to deliver events
73 * and update joystick device state. 75 * and update joystick device state.
74 */ 76 */
75 extern void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick); 77 extern void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick);
76 78
77 /* Function to close a joystick after use */ 79 /* Function to close a joystick after use */
78 extern void SDL_SYS_JoystickClose(SDL_Joystick *joystick); 80 extern void SDL_SYS_JoystickClose(SDL_Joystick * joystick);
79 81
80 /* Function to perform any system-specific joystick related cleanup */ 82 /* Function to perform any system-specific joystick related cleanup */
81 extern void SDL_SYS_JoystickQuit(void); 83 extern void SDL_SYS_JoystickQuit(void);
82 84 /* vi: set ts=4 sw=4 expandtab: */