-
Book Overview & Buying
-
Table Of Contents
OGRE 3D 1.7 Beginner's Guide
Add the timer as a member variable to the frame listener:
Ogre::Timer _timer;
Reset the timer in the constructor:
_timer.reset();
Now add a check to see if 0.25 seconds have passed since the last time the R key was pressed. Only if that is true, will we continue with processing the input:
if(_key->isKeyDown(OIS::KC_R) && _timer.getMilliseconds() > 250)
{
If enough time has passed, we need to reset the timer; otherwise, the R key can only be pressed once:
_timer.reset();
Compile and run the application; when pressing the R key now, it should only change the render mode to the next one.
We used another new class from Ogre 3D, namely, Ogre::Timer. This class offers, as the name suggests, timer functionality. We reset the timer in the constructor of our listener and every time the user presses the R key, we check if 0.25 seconds have passed since the last time we called reset(). If this is the case, we enter the if block and the first...
Change the font size
Change margin width
Change background colour