Home | History | Annotate | Download | only in amigaos

Lines Matching refs:joystick

26 /* This is the system specific header for the SDL joystick API */
49 * joysticks. Joystick 0 should be the system default joystick.
88 /* Function to get the device-dependent name of a joystick */
96 return "Port 1 Amiga Joystick/Joypad";
98 return "Port 2 Amiga Joystick/Joypad";
102 SDL_SetError("No joystick available with that index");
106 /* Function to open a joystick for use.
107 The joystick to open is specified by the index field of the joystick.
108 This should fill the nbuttons and naxes fields of the joystick structure.
112 int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
115 D(bug("Opening joystick %ld\n",joystick->index));
117 if(!(joystick->hwdata=SDL_malloc(sizeof(struct joystick_hwdata))))
124 temp=ReadJoyPort(joystick->index^1); // fix to invert amiga joyports
129 joystick->nbuttons=7;
131 joystick->nbuttons=3;
133 joystick->nhats=0;
134 joystick->nballs=0;
135 joystick->naxes=2;
136 joystick->hwdata->joystate=0L;
141 /* Function to update the state of a joystick - called as a device poll.
142 * This function shouldn't update the joystick structure directly,
144 * and update joystick device state.
146 void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
151 if(joystick->index<2)
153 data=ReadJoyPort(joystick->index);
159 if(!(joystick->hwdata->joystate&JPF_JOY_DOWN))
160 SDL_PrivateJoystickAxis(joystick,0,127);
164 if(!(joystick->hwdata->joystate&JPF_JOY_UP))
165 SDL_PrivateJoystickAxis(joystick,0,-127);
167 else if(joystick->hwdata->joystate&(JPF_JOY_UP|JPF_JOY_DOWN))
168 SDL_PrivateJoystickAxis(joystick,0,0);
172 if(!(joystick->hwdata->joystate&JPF_JOY_LEFT))
173 SDL_PrivateJoystickAxis(joystick,1,-127);
177 if(!(joystick->hwdata->joystate&JPF_JOY_RIGHT))
178 SDL_PrivateJoystickAxis(joystick,1,127);
180 else if(joystick->hwdata->joystate&(JPF_JOY_LEFT|JPF_JOY_RIGHT))
181 SDL_PrivateJoystickAxis(joystick,1,0);
183 else if(joystick->hwdata->joystate&(JPF_JOY_LEFT|JPF_JOY_RIGHT))
185 SDL_PrivateJoystickAxis(joystick,1,0);
187 else if(joystick->hwdata->joystate&(JPF_JOY_UP|JPF_JOY_DOWN))
189 SDL_PrivateJoystickAxis(joystick,0,0);
192 for(i=0;i<joystick->nbuttons;i++)
199 if(!(joystick->hwdata->joystate&joybut[i]))
200 SDL_PrivateJoystickButton(joystick,i,SDL_PRESSED);
202 else if(joystick->hwdata->joystate&joybut[i])
203 SDL_PrivateJoystickButton(joystick,i,SDL_RELEASED);
206 joystick->hwdata->joystate=data;
212 /* Function to close a joystick after use */
213 void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
215 if(joystick->hwdata)
216 SDL_free(joystick->hwdata);
220 /* Function to perform any system-specific joystick related cleanup */