changing the way Time works
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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() {};
|
||||
|
||||
Reference in New Issue
Block a user