files
kolibrios/programs/demos/cubetext/fps.cpp
Andrew 18a96df908
Some checks failed
Build system / Check kernel codestyle (pull_request) Successful in 30s
Build system / Build (pull_request) Failing after 41s
demos/cubetext: Post-SVN tidy
- Move source code from `trunk` into root directory.
2025-05-28 23:15:40 +01:00

48 lines
1.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include<menuet/os.h>
#include "SysCall.h"
/*******************************************************************************
ФУНКЦИЯ ОПРЕДЕЛЕНИЯ FPS
x,y - координаты вывода FPS на окно
возвращает время в сотых долях секунды затрачиваемое на 1 цикл
*/
int time1=0;
int time2=0;
int fps1=0;
int timerend=0;
int Fps (long x, long y)//функция определения FPS
{
int tr;
time1 = SysCall(26,9);//определяем время прошедшее момента запуска системы
if (timerend==0)
{
time2=time1;
timerend=time1;
}
tr = time1 - timerend;
if ((time1 - time2) < 100)//если прошло менее 1 секунды
{ //увеличиваем счетчик fps
fps1++;
}
else
{
//выводим число fps
SysCall(13,(x<<16)+23,(y<<16)+7,0x00555555); //НАРИСОВАТЬ ПОЛОСУ
SysCall(47,4<<16,fps1,(x<<16)+y,0xfafafa);//ВЫВЕСТИ В ОКНО ПРИЛОЖЕНИЯ ЧИСЛО
fps1=0;
time2=time1;
}
timerend=time1;
return tr;
}
//******************************************************************************