Lines Matching refs:joystick

29    Note: Currently assumes joystick is present if joystick module is loaded
30 and that there is one joystick with four buttons.
33 /* This is the system specific header for the SDL joystick API */
52 * joysticks. Joystick 0 should be the system default joystick.
59 /* Try to read joystick 0 */
63 /* Switch works so assume we've got a joystick */
66 /* Switch fails so it looks like there's no joystick here */
71 /* Function to get the device-dependent name of a joystick */
79 SDL_SetError("No joystick available with that index");
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)
92 if(!(joystick->hwdata=SDL_malloc(sizeof(struct joystick_hwdata))))
95 regs.r[0] = joystick->index;
98 joystick->nbuttons=4;
100 joystick->nhats=0;
101 joystick->nballs=0;
102 joystick->naxes=2;
103 joystick->hwdata->joystate=0;
109 /* Function to update the state of a joystick - called as a device poll.
110 * This function shouldn't update the joystick structure directly,
112 * and update joystick device state.
114 void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
117 regs.r[0] = joystick->index;
122 int oldstate = joystick->hwdata->joystate;
130 SDL_PrivateJoystickAxis(joystick,1,-y * 256); /* Up and down opposite to result in SDL */
136 SDL_PrivateJoystickAxis(joystick,0,x * 256);
144 for (i = 0; i < joystick->nbuttons; i++)
148 if (buttons & (1<<i)) SDL_PrivateJoystickButton(joystick,i,SDL_PRESSED);
149 else SDL_PrivateJoystickButton(joystick,i,SDL_RELEASED);
153 joystick->hwdata->joystate = newstate;
160 /* Function to close a joystick after use */
161 void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
163 if(joystick->hwdata)
164 SDL_free(joystick->hwdata);
168 /* Function to perform any system-specific joystick related cleanup */