Original Post
Hi there I use from a high resolution Timer class in my game.The problem is that my game is run with different speeds in different systems! Here's two major functions of this class: code: bool TIMER::Init() { if (!QueryPerformanceFrequency(&m_ticksPerSecond)) { // system doesn't support hi-res timer return false; } else { QueryPerformanceCounter(&m_startTime); return true; } } // end Init() float TIMER::GetElapsedSeconds(unsigned long elapsedFrames) { static LARGE_INTEGER s_lastTime = m_startTime; LARGE_INTEGER currentTime; QueryPerformanceCounter(¤tTime); float seconds = ((float)currentTime.QuadPart - (float)s_lastTime.QuadPart) / (float)m_ticksPerSecond.QuadPart; // reset the timer s_lastTime = currentTime; return seconds; } // end GetElapsedSeconds() I use from this class in this manner: TIMER * timer; In my Init() function I call: timer = new TIMER(); if( !timer->Init() ) { //MessageBox return 0; } At the beginning of Render() function I call: float elapsedTime = timer->GetElapsedSeconds( 1 ); And I use from elapsedTime every time I want to Increment/decrement values. As an example: float index += constant_value * elapsedTime; So what's the problem? -Ehsan- [Edited by - LessBread on January 2, 2007 4:22:34 AM]