Fixed bug identified by Kevin. If pollrate is larger than elapsedtime, we'd wrap, and joystick would never get polled
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1710 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
635ca451cb
commit
2e45756a33
@ -247,11 +247,12 @@ void FGAPIENTRY glutJoystickFunc( FGCBJoystick callback, int pollInterval )
|
|||||||
SET_CALLBACK( Joystick );
|
SET_CALLBACK( Joystick );
|
||||||
fgStructure.CurrentWindow->State.JoystickPollRate = pollInterval;
|
fgStructure.CurrentWindow->State.JoystickPollRate = pollInterval;
|
||||||
|
|
||||||
fgStructure.CurrentWindow->State.JoystickLastPoll =
|
/* set last poll time such that joystick will be polled asap */
|
||||||
fgElapsedTime() - fgStructure.CurrentWindow->State.JoystickPollRate;
|
fgStructure.CurrentWindow->State.JoystickLastPoll = fgElapsedTime();
|
||||||
|
if (fgStructure.CurrentWindow->State.JoystickLastPoll < pollInterval)
|
||||||
if( fgStructure.CurrentWindow->State.JoystickLastPoll < 0 )
|
|
||||||
fgStructure.CurrentWindow->State.JoystickLastPoll = 0;
|
fgStructure.CurrentWindow->State.JoystickLastPoll = 0;
|
||||||
|
else
|
||||||
|
fgStructure.CurrentWindow->State.JoystickLastPoll -= pollInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user