Save Manager

This commit is contained in:
2022-12-17 23:18:06 -08:00
parent 4090e61406
commit 1dbfd9f42e
23 changed files with 574 additions and 15 deletions

View File

@ -6,5 +6,5 @@
# Sources
target_sources(${DAWN_TARGET_NAME}
PRIVATE
TimeManager.cpp
ITimeManager.cpp
)

View File

@ -3,15 +3,15 @@
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "TimeManager.hpp"
#include "ITimeManager.hpp"
using namespace Dawn;
TimeManager::TimeManager() {
ITimeManager::ITimeManager() {
}
void TimeManager::update(float_t delta) {
void ITimeManager::update(float_t delta) {
this->delta = delta;
this->time += delta;
if(!this->isPaused) {
@ -19,13 +19,13 @@ void TimeManager::update(float_t delta) {
}
}
void TimeManager::pause() {
void ITimeManager::pause() {
if(this->isPaused) return;
this->isPaused = true;
this->eventTimePaused.invoke();
}
void TimeManager::resume() {
void ITimeManager::resume() {
if(!this->isPaused) return;
this->isPaused = false;
this->eventTimeResumed.invoke();

View File

@ -8,7 +8,7 @@
#include "event/Event.hpp"
namespace Dawn {
class TimeManager {
class ITimeManager {
public:
float_t time = 0.0f;
float_t unpausedTime = 0.0f;
@ -21,7 +21,7 @@ namespace Dawn {
/**
* Constructor for the Time Manager.
*/
TimeManager();
ITimeManager();
/**
* Updates / Ticks the time manager instance.
@ -39,5 +39,12 @@ namespace Dawn {
* Resumes the game.
*/
void resume();
/**
* Returns the current system timestamp.
*
* @return Current timestamp.
*/
virtual int64_t getTimestamp() = 0;
};
}