Data, Horario, FPS
Bom Galera, Achei essas Funções em uma Base, então quero compartilhar com quem nao teve a oportunidade de encontra - las
Code:
CHAR *cFunctions::D3DFps()
{
static char FrameRate[50] = "";
static float myFPS, LastCount, CurrentCount;
CurrentCount = clock() * 0.001f;
++myFPS;
if((CurrentCount - LastCount) > 1.0f) {
LastCount = CurrentCount;
sprintf(FrameRate, "[Game FPS: %d]", INT(myFPS));
myFPS = NULL;
}
return FrameRate;
}
CHAR *cFunctions::Date(VOID)
{
static CHAR cdate[1524] = "";
struct tm * current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
sprintf(cdate, "Dia: %02d / %d / %d", current_tm->tm_mday, current_tm->tm_mon + 1, current_tm->tm_year - 100 + 2000);
return cdate;
}
CHAR *cFunctions::Time(VOID)
{
static CHAR ctime[1524] = "";
struct tm *current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
if(current_tm->tm_hour>12)
sprintf(ctime, "Horario: %d:%02d:%02d PM", current_tm->tm_hour - 12, current_tm->tm_min, current_tm->tm_sec);
else
sprintf(ctime, "Horario: %d:%02d:%02d AM", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec);
return ctime;
}
Code:
if(Var.Folder[5]) {
DrawBox(PosX + 167, PosY, 120, 40, TBlack, Black, pDevice);
DrawText(pDevice, PosX + 175, PosY + 03, Red, Functions->D3DFps()) // FPS
DrawText(pDevice, PosX + 175, PosY + 15, Red, Functions->Date()); // Data
DrawText(pDevice, PosX + 175, PosY + 25, Red, Functions->Time()); // Hórario
}
}

Créditos:
@Qmo







