Crediti: AlbertoX
Ecco il souce per l'FPS :
Definizioni :
Code:
float fFps = NULL;
float fLastTickCount = NULL;
float fCurrentTickCount;
char cFrameRate[50] = {NULL};
Il nostro Char :
Code:
char *GetFrameRate()
{
fCurrentTickCount = clock() * 0.001f;
++fFps;
if((fCurrentTickCount - fLastTickCount) > 1.0f)
{
fLastTickCount = fCurrentTickCount;
sprintf( cFrameRate, " %d ", int( fFps ) );
fFps = 0;
}
return cFrameRate;
}
Source Time
Ecco il Char :
Code:
char *GetTime()
{
struct tm * current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
char *logbuf = new char[ 256 ];
sprintf(logbuf, "-: %02d:%02d:%02d :-", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec );
return logbuf;
}