Time & FPS

Posts 15 of 5 · Page 1 of 1
Time & FPS
Didn't see it up here, pretty simple. Just thought I'd share for those who didn't have it.

Simple Time Display:

Code:
#include <ctime>

time_t t = time(0);

//To Use
DrawString(x, y, Colour,pFont, ctime( &t ));
FPS Display:

Code:
char sFPS[20]="xxx Fps";


int	  FPScounter = 0;
float FPSfLastTickCount = 0.0f;
float FPSfCurrentTickCount;

void FPScheck(char *str, char *format)
{
	FPSfCurrentTickCount = (clock() * 0.001f);
	FPScounter++;

	if((FPSfCurrentTickCount - FPSfLastTickCount) > 1.0f) {
	    FPSfLastTickCount = FPSfCurrentTickCount;
		sprintf(str,format,FPScounter);
	    FPScounter = 0;
	} 
}

//To use
DrawString(x, y, Colour, pFont, sFPS);
Credits to whoever.
thx this is really helpful
very good
I use in my next release
In FPS need to add these libraries

Code:
#include <time.h>
#include <stdio.h>
Posts 15 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?