#include <ctime> time_t t = time(0); //To Use DrawString(x, y, Colour,pFont, ctime( &t ));
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);
#include <time.h> #include <stdio.h>