载入中...
搜索中...
未找到
Timer.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Module.h"
4
5#include <cstdint>
6
7namespace eve::timer {
8
13class Timer : public Module {
14public:
16 Timer();
17 ~Timer() override = default;
18
23 float getTime() const;
25 float getDelta() const;
27 float step();
28
29private:
30 uint64_t freq_ = 0;
31 uint64_t start_ = 0;
32 uint64_t prev_ = 0;
33 float delta_ = 0.f;
34};
35
36} // namespace eve::timer
High-resolution frame/elapsed timer backed by SDL_GetPerformanceCounter(). Script: timer <- eve....
Definition Timer.h:13
float step()
Advances the frame clock and returns the new delta in seconds.
Definition Timer.cpp:26
float getDelta() const
Seconds between the last two step() calls (0 until the first step).
Definition Timer.cpp:24
float getTime() const
Seconds since the Timer was created (0 if the timer is unavailable). Returns float (not double): Simp...
Definition Timer.cpp:19
~Timer() override=default