Brenta Engine 1.2
Loading...
Searching...
No Matches
time.cpp
1// SPDX-License-Identifier: MIT
2// Author: Giovanni Santini
3// Mail: giovanni.santini@proton.me
4// Github: @San7o
5
6#include <brenta/window.hpp>
7#include <brenta/time.hpp>
8
9using namespace brenta;
10
11float time::current_time = 0.0f;
12float time::delta_time = 0.0f;
13float time::last_frame = 0.0f;
14
16{
17 return window::get_time();
18}
19
21{
22 return time::delta_time;
23}
24
26{
27 return 1.0f / time::delta_time;
28}
29
30void time::update(float new_time)
31{
32 time::current_time = new_time;
33 time::delta_time = time::current_time - time::last_frame;
34 time::last_frame = time::current_time;
35}
static float get_current_time()
Get the current time.
Definition time.cpp:15
static void update(float new_time)
Update the time.
Definition time.cpp:30
static float get_delta_time()
Get the time since the last frame.
Definition time.cpp:20
static float get_fps()
Get the frames per second.
Definition time.cpp:25