comparison src/joystick/SDL_sysjoystick.h @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents d910939febfa
children 4da1ee79c9af
comparison
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
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
56 * on an unrecoverable fatal error. 58 * on an unrecoverable fatal error.
57 */ 59 */
58 extern int SDL_SYS_JoystickInit(void); 60 extern int SDL_SYS_JoystickInit (void);
59 61
60 /* Function to get the device-dependent name of a joystick */ 62 /* Function to get the device-dependent name of a joystick */
61 extern const char *SDL_SYS_JoystickName(int index); 63 extern const char *SDL_SYS_JoystickName (int index);
62 64
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: */