8 std::chrono::time_point<std::chrono::steady_clock> last_render_time{};
9 std::chrono::time_point<std::chrono::steady_clock> last_compute_time{};
18 std::chrono::time_point<std::chrono::steady_clock> now = std::chrono::steady_clock::now();
19 if(last_render_time == std::chrono::time_point<std::chrono::steady_clock>{}) {
20 last_render_time = now;
22 auto microseconds_since_last_render = std::chrono::duration_cast<std::chrono::microseconds>(now - last_render_time);
23 auto microseconds_since_last_compute = std::chrono::duration_cast<std::chrono::microseconds>(now - last_compute_time);
24 if(microseconds_since_last_render.count() > 0.f && microseconds_since_last_compute.count() > 1e5) {
25 auto frames_per_second = 1.f / float(microseconds_since_last_render.count() / 1e6);
27 last_compute_time = now;
29 last_render_time = now;
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
Holds important data about the game world, state, and other data regarding windowing,...