changing the way Time works

This commit is contained in:
Erris
2026-01-23 15:42:39 +01:00
parent 1a584bcd2f
commit 33574d783a
2 changed files with 6 additions and 6 deletions

View File

@@ -113,7 +113,7 @@ class SandboxLayer : public OpenEngine::Layer
void moveSquare(glm::vec3& position)
{
float velocity = 1 * OpenEngine::Time::Get().DeltaTime();
float velocity = 1 * OpenEngine::Time::DeltaTime();
if (OpenEngine::Input::IsKeyPressed(OE_KEY_I))
position.y += velocity;
if (OpenEngine::Input::IsKeyPressed(OE_KEY_Y))

View File

@@ -10,17 +10,17 @@ namespace OpenEngine {
Time(const Time&) = delete; // No copy constructor
Time& operator=(const Time&) = delete;
void Update();
static void Update();
static Time& Get()
static void Init()
{
if (instance == nullptr)
instance.reset(new Time);
return *instance;
}
double DeltaTime() const { return delta_time.count(); };
static double DeltaTime() {
return instance->delta_time.count();
};
private:
Time() {};