HighPerformanceCounter for TimeBasedMovement

Started by
10 comments, last by DarkKiller 21 years, 9 months ago
ok, it works.

I don''t really know why it doesn''t in the past but I don''t care

GLfloat Val2Proc(){	static DWORD tickold=(GetTickCount()-10);	static DWORD tick;	float  valproc;	tick = GetTickCount();	valproc = ((tick) - (tickold));	tickold = tick;	return valproc*0.05f;} 


The only prolem is that it would be better if I get good float values from it but its enough for the moment.
DarkMcNugget next time... ;)
Advertisement
That code I posted is not from my FPS counter, so I am not sure how it would fare as one. It is only for time-based movement. In case you wanted to see my clock function (for FPS), here it is:

  	void CEruClock::update()	{		curTime = timeGetTime();		totalTime += curTime - startTime;		startTime = curTime;		if (totalTime > 1000)		{			m_fps = (float)( ((float)framesRendered / (float)totalTime) * 1000 );			totalTime = 0;			framesRendered = 0;		}		framesRendered++;	}  


I call that update function once per frame, and I also call another function which returns m_fps once per frame.

NOTE: This is not my code. I forget where I got this from, but I forgot to put a note in my source code. If this class is yours, please tell me!

This topic is closed to new replies.

Advertisement