Time, Mr. Freeman?
This commit is contained in:
9
src/dawn/time/CMakeLists.txt
Normal file
9
src/dawn/time/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
ITimeManager.cpp
|
||||
)
|
17
src/dawn/time/ITimeManager.cpp
Normal file
17
src/dawn/time/ITimeManager.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "ITimeManager.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
void ITimeManager::tick(float_t delta) {
|
||||
this->delta = delta;
|
||||
this->time += delta;
|
||||
}
|
||||
|
||||
ITimeManager::~ITimeManager() {
|
||||
|
||||
}
|
34
src/dawn/time/ITimeManager.hpp
Normal file
34
src/dawn/time/ITimeManager.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "dawnlibs.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class ITimeManager {
|
||||
public:
|
||||
float_t delta = 0.016f;
|
||||
float_t time = 0.016f;
|
||||
|
||||
/**
|
||||
* Ticks / updates the time management system.
|
||||
*
|
||||
* @param delta Time delta in seconds.
|
||||
*/
|
||||
void tick(float_t delta);
|
||||
|
||||
/**
|
||||
* Returns the real world time epoch.
|
||||
*
|
||||
* @return Epoch time in milliseconds.
|
||||
*/
|
||||
virtual int64_t getRealTime() = 0;
|
||||
|
||||
/**
|
||||
* Cleans up the time manager.
|
||||
*/
|
||||
virtual ~ITimeManager();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user