Formatting code

This commit is contained in:
Ilusha 2023-06-30 14:02:55 +00:00
parent 6dc64ce76b
commit 13a8f07e32
37 changed files with 2242 additions and 2281 deletions

View file

@ -4,55 +4,55 @@
namespace tp {
typedef alni time_ms;
typedef alni time_ns;
typedef alni time_ms;
typedef alni time_ns;
extern time_ms gCurrentTime;
extern time_ms gCurrentTime;
class Timer {
class Timer {
time_ms mStart;
time_ms mDuration;
time_ms mStart;
time_ms mDuration;
public:
public:
Timer();
explicit Timer(time_ms time);
Timer();
explicit Timer(time_ms time);
time_ms start();
time_ms duration();
void setDuration(time_ms dur);
time_ms start();
time_ms duration();
void setDuration(time_ms dur);
bool isTimeout();
void reset();
time_ms timePassed();
time_ms remainder();
void wait();
bool isTimeout();
void reset();
time_ms timePassed();
time_ms remainder();
void wait();
float easeIn(time_ms duration = 0);
float easeOut(time_ms duration = 0);
};
float easeIn(time_ms duration = 0);
float easeOut(time_ms duration = 0);
};
void sleep(time_ms duration);
time_ms get_time();
void sleep(time_ms duration);
time_ms get_time();
struct FpsCounter {
halni frames = 0;
Timer time;
halni fps = 0;
struct FpsCounter {
halni frames = 0;
Timer time;
halni fps = 0;
FpsCounter() : time(1000) {}
FpsCounter() : time(1000) {}
void update(bool log = true) {
frames++;
if (time.isTimeout()) {
fps = frames;
if (log) {
// printf("fps %i \n", fps);
}
frames = 0;
time.reset();
}
}
};
void update(bool log = true) {
frames++;
if (time.isTimeout()) {
fps = frames;
if (log) {
// printf("fps %i \n", fps);
}
frames = 0;
time.reset();
}
}
};
}