36 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
38 #define NO_SDL_JOYSTICK
76 joystick_exponent ) );
93 joystick[0]->joy_axis[i] = 0.0;
97 if (joystick[0]->nr_of_axes > 0)
103 if (joystick[0]->nr_of_axes > 1)
107 if (joystick[0]->nr_of_axes > 2)
142 #ifndef NO_SDL_JOYSTICK
146 printf(
"The names of the joysticks are:\n" );
150 printf(
"setting joystick functionality:: joystick online" );
157 #ifndef NO_SDL_JOYSTICK
160 printf(
" %s\n", SDL_JoystickName( i ) );
165 printf(
"Glut detects %d joystick", i+1 );
198 #if defined (NO_SDL_JOYSTICK)
209 joy = SDL_JoystickOpen( which );
211 printf(
"warning: no joystick nr %d\n", which );
229 #endif //we have GLUT
233 void JoyStick::InitMouse(
int which )
264 void JoyStick::GetMouse(
float &
x,
float &
y,
float &z,
int &buttons )
266 int def_mouse_sens = 1;
272 if ( 0 && (_dx || _dy) )
273 printf(
"x:%d y:%d\n", _dx, _dy );
279 static std::list< mouseData > md;
280 std::list< mouseData >::iterator
i = md.begin();
283 int avg = (_dx || _dy) ? 1 : 0;
286 for (; i != md.end();) {
287 if ( (*i).time >= lasttime ) {
291 if ( (ldx >= 0)*_dx*ldx == (_dx >= 0)*_dx*ldx ) {
296 if ( (ldy >= 0)*_dy*ldy == (_dy >= 0)*_dy*ldy ) {
304 }
else if ( ( i = md.erase( i ) ) == md.end() ) {
309 md.push_back(
mouseData( _dx, _dy, ttime ) );
339 GetMouse( x, y, z, buttons );
343 #ifndef NO_SDL_JOYSTICK
344 #if defined (HAVE_SDL)
345 int numaxes = SDL_JoystickNumAxes( joy );
348 for (a = 0; a < numaxes; a++)
349 axi[a] = SDL_JoystickGetAxis( joy, a );
353 int butt = SDL_JoystickGetButton( joy, i );
360 joy_axis[a] = ( (
float) axi[
a]/32768.0 );
365 glutForceJoystickFunc();
371 #endif //we have no joystick