Skip to content

Commit

Permalink
fixed first DeltaTime being too big
Browse files Browse the repository at this point in the history
  • Loading branch information
RiverHillbug committed Jun 5, 2024
1 parent 7977e42 commit 88483a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions FluffyEngine/FluffyEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ namespace Fluffy
auto& sceneManager = SceneManager::GetInstance();
auto& input = InputManager::GetInstance();

FluffyTime::Init();

bool doContinue = true;

//const float millisecondsPerFrame{ 1.0f / 60.0f }; // 60 FPS
Expand Down
5 changes: 5 additions & 0 deletions FluffyEngine/FluffyTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ namespace Fluffy
return m_CurrentTime;
}

void FluffyTime::Init()
{
m_PreviousTime = std::chrono::high_resolution_clock::now();
}

void FluffyTime::Update()
{
m_CurrentTime = std::chrono::high_resolution_clock::now();
Expand Down
1 change: 1 addition & 0 deletions FluffyEngine/FluffyTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Fluffy
public:
static float DeltaTime();
static std::chrono::high_resolution_clock::time_point GetCurrent();
static void Init();
static void Update();

private:
Expand Down

0 comments on commit 88483a4

Please sign in to comment.