Hi,
Does anybody know if there is a Hi Res Timer for BlitzMax. I have found some C++ code in the NewtonSDK for one but, it uses glutget to query the graphics hardware. I don't know how to do this in BMax.
The C++ code snippet for the timer (Note: this is taken from a class so variables declarations etc are in the header).
Any help would be greatly appreciated.
Does anybody know if there is a Hi Res Timer for BlitzMax. I have found some C++ code in the NewtonSDK for one but, it uses glutget to query the graphics hardware. I don't know how to do this in BMax.
The C++ code snippet for the timer (Note: this is taken from a class so variables declarations etc are in the header).
dFloat timeStep; unsigned miliseconds; miliseconds = glutGet (GLUT_ELAPSED_TIME); // optimal keep the fps below 70 fps #ifdef LOCK_FRAME_RATE while ((miliseconds - m_prevTime) < 14) { miliseconds = glutGet (GLUT_ELAPSED_TIME); } #endif timeStep = dFloat (miliseconds - m_prevTime) * TICKS2SEC; m_prevTime = miliseconds; if (timeStep > 0.1f) { timeStep = 0.1f; } if (timeStep < 0.005f) { timeStep = 0.005f; } #ifdef RECORD_LOG // Sleep (100); extern FILE * file; fwrite (&timeStep, sizeof (float), 1, file); fflush (file); #endif #ifdef READ_LOG extern FILE * file; //Sleep (150); fread (&timeStep, sizeof (float), 1, file); #endif return timeStep;
Any help would be greatly appreciated.