forked from KolibriOS/kolibrios
91c643be8c
git-svn-id: svn://kolibrios.org@1971 a494cfbc-eb01-0410-851d-a64ba20cac60
52 lines
840 B
Plaintext
52 lines
840 B
Plaintext
int GetTime()
|
|
{
|
|
$mov eax, 26;
|
|
$mov ebx, 9;
|
|
$int 0x40;
|
|
return EAX;
|
|
}
|
|
|
|
|
|
/*******************************************************************************
|
|
ÔÓÍÊÖÈß ÎÏÐÅÄÅËÅÍÈß FPS
|
|
x,y - êîîðäèíàòû âûâîäà FPS íà îêíî
|
|
âîçâðàùàåò âðåìÿ â ñîòûõ äîëÿõ ñåêóíäû çàòðà÷èâàåìîå íà 1 öèêë
|
|
*/
|
|
|
|
int time1=0;
|
|
int time2=0;
|
|
int fps1=0;
|
|
int timerend=0;
|
|
|
|
int FPS()
|
|
{
|
|
int tr;
|
|
|
|
time1=GetTime();
|
|
|
|
if (timerend==0)
|
|
{
|
|
time2=time1;
|
|
timerend=time1;
|
|
}
|
|
|
|
tr = time1 - timerend;
|
|
|
|
if (time1 - time2 < 100) //åñëè ïðîøëî ìåíåå 1 ñåêóíäû
|
|
{ //óâåëè÷èâàåì ñ÷åò÷èê fps
|
|
fps1++;
|
|
}
|
|
else
|
|
{
|
|
//âûâîäèì ÷èñëî fps
|
|
DrawTitle(IntToStr(fps1));
|
|
fps1=0;
|
|
time2=time1;
|
|
}
|
|
|
|
timerend=time1;
|
|
|
|
return tr;
|
|
}
|
|
//******************************************************************************
|