Joe Krahn\'s input (dials) device implementation.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@636 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
2ded92b062
commit
a84f4042f0
@ -27,6 +27,7 @@ lib@LIBRARY@_la_SOURCES = freeglut_callbacks.c \
|
|||||||
freeglut_gamemode.c \
|
freeglut_gamemode.c \
|
||||||
freeglut_geometry.c \
|
freeglut_geometry.c \
|
||||||
freeglut_init.c \
|
freeglut_init.c \
|
||||||
|
freeglut_input_devices.c \
|
||||||
freeglut_joystick.c \
|
freeglut_joystick.c \
|
||||||
freeglut_main.c \
|
freeglut_main.c \
|
||||||
freeglut_menu.c \
|
freeglut_menu.c \
|
||||||
|
@ -82,7 +82,8 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */
|
|||||||
GLUT_ACTION_EXIT, /* ActionOnWindowClose */
|
GLUT_ACTION_EXIT, /* ActionOnWindowClose */
|
||||||
GLUT_EXEC_STATE_INIT, /* ExecState */
|
GLUT_EXEC_STATE_INIT, /* ExecState */
|
||||||
NULL, /* ProgramName */
|
NULL, /* ProgramName */
|
||||||
GL_FALSE /* JoysticksInitialised */
|
GL_FALSE, /* JoysticksInitialised */
|
||||||
|
GL_FALSE /* InputDevsInitialised */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -202,6 +203,9 @@ static void fghInitialize( const char* displayName )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
fgState.Initialised = GL_TRUE;
|
fgState.Initialised = GL_TRUE;
|
||||||
|
|
||||||
|
/* InputDevice uses GlutTimerFunc(), so fgState.Initialised must be TRUE */
|
||||||
|
fgInitialiseInputDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -242,8 +246,12 @@ void fgDeinitialize( void )
|
|||||||
#if !TARGET_HOST_WINCE
|
#if !TARGET_HOST_WINCE
|
||||||
if ( fgState.JoysticksInitialised )
|
if ( fgState.JoysticksInitialised )
|
||||||
fgJoystickClose( );
|
fgJoystickClose( );
|
||||||
|
|
||||||
|
if ( fgState.InputDevsInitialised )
|
||||||
|
fgInputDeviceClose( );
|
||||||
#endif /* !TARGET_HOST_WINCE */
|
#endif /* !TARGET_HOST_WINCE */
|
||||||
fgState.JoysticksInitialised = GL_FALSE;
|
fgState.JoysticksInitialised = GL_FALSE;
|
||||||
|
fgState.InputDevsInitialised = GL_FALSE;
|
||||||
|
|
||||||
fgState.Initialised = GL_FALSE;
|
fgState.Initialised = GL_FALSE;
|
||||||
|
|
||||||
|
@ -244,6 +244,7 @@ struct tagSFG_State
|
|||||||
fgExecutionState ExecState; /* Used for GLUT termination */
|
fgExecutionState ExecState; /* Used for GLUT termination */
|
||||||
char *ProgramName; /* Name of the invoking program */
|
char *ProgramName; /* Name of the invoking program */
|
||||||
GLboolean JoysticksInitialised; /* Only initialize if application calls for them */
|
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 */
|
/* The structure used by display initialization in freeglut_init.c */
|
||||||
@ -772,6 +773,11 @@ int glutJoystickGetNumAxes( int ident );
|
|||||||
int glutJoystickGetNumButtons( int ident );
|
int glutJoystickGetNumButtons( int ident );
|
||||||
int glutJoystickNotWorking( 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 */
|
/* Setting the cursor for a given window */
|
||||||
void fgSetCursor ( SFG_Window *window, int cursorID );
|
void fgSetCursor ( SFG_Window *window, int cursorID );
|
||||||
|
|
||||||
|
@ -1581,7 +1581,6 @@ static void fghJoystickInit( int ident )
|
|||||||
*/
|
*/
|
||||||
void fgInitialiseJoysticks ( void )
|
void fgInitialiseJoysticks ( void )
|
||||||
{
|
{
|
||||||
/* Initialization courtesy of OpenGLUT -- do we want it? */
|
|
||||||
if( !fgState.JoysticksInitialised )
|
if( !fgState.JoysticksInitialised )
|
||||||
{
|
{
|
||||||
int ident ;
|
int ident ;
|
||||||
|
@ -540,14 +540,21 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
|
|||||||
case GLUT_JOYSTICK_AXES:
|
case GLUT_JOYSTICK_AXES:
|
||||||
return glutJoystickGetNumAxes ( 0 );
|
return glutJoystickGetNumAxes ( 0 );
|
||||||
|
|
||||||
case GLUT_HAS_SPACEBALL:
|
|
||||||
case GLUT_HAS_DIAL_AND_BUTTON_BOX:
|
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:
|
case GLUT_HAS_TABLET:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
case GLUT_NUM_SPACEBALL_BUTTONS:
|
case GLUT_NUM_SPACEBALL_BUTTONS:
|
||||||
case GLUT_NUM_BUTTON_BOX_BUTTONS:
|
|
||||||
case GLUT_NUM_DIALS:
|
|
||||||
case GLUT_NUM_TABLET_BUTTONS:
|
case GLUT_NUM_TABLET_BUTTONS:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user