Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Time.cpp
Go to the documentation of this file.
2 #include "Engine/engine.hpp"
4 
5 namespace Engine
6 {
7  float beginTime = 0;
8  float endTime = 0;
9 
10  Time::Time() : deltaTime(0)
11  {
12  previousFramerates.resize(maxIterations);
13  }
14 
15  float Time::GetDeltaTime() const
16  {
17  return deltaTime;
18  }
19 
21  {
22  return maxIterations;
23  }
24 
25  eastl::vector<float> Time::GetPreviousFramerates() const
26  {
27  return previousFramerates;
28  }
29 
30  void Time::OnUpdateBegin()
31  {
32  beginTime = float(glfwGetTime());
33  }
34 
35  void Time::OnUpdateEnd()
36  {
37  endTime = float(glfwGetTime());
38  deltaTime = beginTime > 0.0 ? float(endTime - beginTime) : float(1.0f / 60.0f);
39  previousFramerates[iterations + 1 >= maxIterations ? 0 : iterations + 1] = ImGui::GetIO().Framerate;
40  iterations++;
41  }
42 } //namespace Engine
float Framerate
Definition: imgui.h:860
eastl::vector< float > GetPreviousFramerates() const
This method allows you to get a vector of floats from the previous frames their delta times...
Definition: Time.cpp:25
IMGUI_API ImGuiIO & GetIO()
Definition: imgui.cpp:2144
int GetMaxIterations() const
This method is used to get the maximum amount of iterations for the previous frame rates...
Definition: Time.cpp:20
float endTime
Definition: Time.cpp:8
float GetDeltaTime() const
This method allows you to get the current deltaTime.
Definition: Time.cpp:15
float beginTime
Definition: Time.cpp:7