I would like to enable some kind of pausing in my application. I'm working on a memory game, where the pictures are shown for 8 seconds only. During these 8 seconds no interactions are allowed... I implemented this easy method:
Code: Select all
void pauseIrrlicht( int _seconds )
{
txtLog.writeLogDigit("pauseIrrlicht(): Started. Pausing for seconds: " , _seconds );
int loop = 1;
time_t start , end;
time( &start );
while ( loop )
{
time( &end );
if ( difftime (end,start) > (double)_seconds )
loop = 0;
}
txtLog.writeLog("pauseIrrlicht(): Finished.");
}
09:49:43809 pauseIrrlicht(): Started. Pausing for seconds: 8
09:49:52000 pauseIrrlicht(): Finished.
However, in some cases I experience interesting behaviour. The second picture is shown for 15 sec approx, and the third only for 1 sec... The log file shows correct timing, so maybe the issue is with some kind of screen refreshing/updating.
This is how I use the function (I call this sequence several times, based on the number of pictures to show)
Code: Select all
smgr->drawAll();
env->drawAll();
pauseIrrlicht(8);
Ex3_WindowMaker( device->getGUIEnvironment() , admin._irrList[i] , admin._irrFile[i] ) ;
What can be the reason of this behaviour?
Thanks!!!