I want to sync my game speed using Warmi's formula. Am I doing it right?
I cant find a good function to round off the value.
- Code:
//FLOAT nFrameRate = 0;
//m_timer.GetActualFrameRate(&nFrameRate;);
int GameSpeedX = 0;
int DEF_TARGET_FPS = 40;
FLOAT nActualFrameTime = 0;
m_timer.GetActualFrameTime(&nActualFrameTime;);
int FrameRateRatio = int( DEF_TARGET_FPS/nActualFrameTime);
GameSpeedX += (GameSpeedX*FrameRateRatio);
I cant find a good function to round off the value.