Home | History | Annotate | Download | only in dc

Lines Matching full:joystick

35 #define MAX_AXES	6	/* each joystick can have up to 6 axes */
41 /* array to hold joystick ID values */
44 /* The private structure used to keep track of a joystick */
53 * joysticks. Joystick 0 should be the system default joystick.
75 /* Function to get the device-dependent name of a joystick */
83 /* Function to open a joystick for use.
84 The joystick to open is specified by the index field of the joystick.
85 This should fill the nbuttons and naxes fields of the joystick structure.
88 int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
91 joystick->hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
92 if (joystick->hwdata == NULL)
97 SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
100 joystick->nbuttons = MAX_BUTTONS;
101 joystick->naxes = MAX_AXES;
102 joystick->nhats = MAX_HATS;
107 /* Function to update the state of a joystick - called as a device poll.
108 * This function shouldn't update the joystick structure directly,
110 * and update joystick device state.
113 void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
130 addr = SYS_Joystick_addr[joystick->index];
134 prev_buttons = joystick->hwdata->prev_buttons;
143 SDL_PrivateJoystickHat(joystick, 0, hat);
151 SDL_PrivateJoystickHat(joystick, 1, hat);
156 SDL_PrivateJoystickButton(joystick, i, (buttons & sdl_buttons[i])?SDL_PRESSED:SDL_RELEASED);
160 prev_cond = &joystick->hwdata->prev_cond;
162 SDL_PrivateJoystickAxis(joystick, 0, cond.joyx-128);
164 SDL_PrivateJoystickAxis(joystick, 1, cond.joyy-128);
166 SDL_PrivateJoystickAxis(joystick, 2, cond.rtrig);
168 SDL_PrivateJoystickAxis(joystick, 3, cond.ltrig);
170 SDL_PrivateJoystickAxis(joystick, 4, cond.joy2x-128);
172 SDL_PrivateJoystickAxis(joystick, 5, cond.joy2y-128);
174 joystick->hwdata->prev_buttons = buttons;
175 joystick->hwdata->prev_cond = cond;
178 /* Function to close a joystick after use */
179 void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
181 if (joystick->hwdata != NULL) {
183 SDL_free(joystick->hwdata);
187 /* Function to perform any system-specific joystick related cleanup */