Dawn/src/dawn/time/TimeManager.cpp

32 lines
610 B
C++

// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "TimeManager.hpp"
using namespace Dawn;
TimeManager::TimeManager() {
}
void TimeManager::update(float_t delta) {
this->delta = delta;
this->time += delta;
if(!this->isPaused) {
this->unpausedTime += delta;
}
}
void TimeManager::pause() {
if(this->isPaused) return;
this->isPaused = true;
this->eventTimePaused.invoke();
}
void TimeManager::resume() {
if(!this->isPaused) return;
this->isPaused = false;
this->eventTimeResumed.invoke();
}