freeglut_gamemode.c \
freeglut_geometry.c \
freeglut_init.c \
+ freeglut_input_devices.c \
freeglut_joystick.c \
freeglut_main.c \
freeglut_menu.c \
GLUT_ACTION_EXIT, /* ActionOnWindowClose */
GLUT_EXEC_STATE_INIT, /* ExecState */
NULL, /* ProgramName */
- GL_FALSE /* JoysticksInitialised */
+ GL_FALSE, /* JoysticksInitialised */
+ GL_FALSE /* InputDevsInitialised */
};
#endif
fgState.Initialised = GL_TRUE;
+
+ /* InputDevice uses GlutTimerFunc(), so fgState.Initialised must be TRUE */
+ fgInitialiseInputDevices();
}
/*
#if !TARGET_HOST_WINCE
if ( fgState.JoysticksInitialised )
fgJoystickClose( );
+
+ if ( fgState.InputDevsInitialised )
+ fgInputDeviceClose( );
#endif /* !TARGET_HOST_WINCE */
fgState.JoysticksInitialised = GL_FALSE;
+ fgState.InputDevsInitialised = GL_FALSE;
fgState.Initialised = GL_FALSE;
fgExecutionState ExecState; /* Used for GLUT termination */
char *ProgramName; /* Name of the invoking program */
GLboolean JoysticksInitialised; /* Only initialize if application calls for them */
+ GLboolean InputDevsInitialised; /* Only initialize if application calls for them */
};
/* The structure used by display initialization in freeglut_init.c */
int glutJoystickGetNumButtons( int ident );
int glutJoystickNotWorking( int ident );
+/* InputDevice Init/Fini */
+int fgInputDeviceDetect( void );
+void fgInitialiseInputDevices( void );
+void fgInputDeviceClose( void );
+
/* Setting the cursor for a given window */
void fgSetCursor ( SFG_Window *window, int cursorID );
*/
void fgInitialiseJoysticks ( void )
{
- /* Initialization courtesy of OpenGLUT -- do we want it? */
- if( !fgState.JoysticksInitialised )
- {
- int ident ;
- for ( ident = 0; ident < MAX_NUM_JOYSTICKS; ident++ )
- fghJoystickInit( ident );
+ if( !fgState.JoysticksInitialised )
+ {
+ int ident ;
+ for ( ident = 0; ident < MAX_NUM_JOYSTICKS; ident++ )
+ fghJoystickInit( ident );
- fgState.JoysticksInitialised = GL_TRUE;
- }
+ fgState.JoysticksInitialised = GL_TRUE;
+ }
}
/*
*/
int fgJoystickDetect( void )
{
- int ident;
+ int ident;
- fgInitialiseJoysticks ();
+ fgInitialiseJoysticks ();
- if ( !fgJoystick )
- return 0;
+ if ( !fgJoystick )
+ return 0;
- if ( !fgState.JoysticksInitialised )
- return 0;
+ if ( !fgState.JoysticksInitialised )
+ return 0;
- for( ident=0; ident<MAX_NUM_JOYSTICKS; ident++ )
- if( fgJoystick[ident] && !fgJoystick[ident]->error )
- return 1;
+ for( ident=0; ident<MAX_NUM_JOYSTICKS; ident++ )
+ if( fgJoystick[ident] && !fgJoystick[ident]->error )
+ return 1;
- return 0;
+ return 0;
}
/*
case GLUT_JOYSTICK_AXES:
return glutJoystickGetNumAxes ( 0 );
- case GLUT_HAS_SPACEBALL:
case GLUT_HAS_DIAL_AND_BUTTON_BOX:
+ return fgInputDeviceDetect ();
+
+ case GLUT_NUM_DIALS:
+ if ( fgState.InputDevsInitialised ) return 8;
+ return 0;
+
+ case GLUT_NUM_BUTTON_BOX_BUTTONS:
+ return 0;
+
+ case GLUT_HAS_SPACEBALL:
case GLUT_HAS_TABLET:
return FALSE;
case GLUT_NUM_SPACEBALL_BUTTONS:
- case GLUT_NUM_BUTTON_BOX_BUTTONS:
- case GLUT_NUM_DIALS:
case GLUT_NUM_TABLET_BUTTONS:
return 0;