abbandoning Lua... Error in runtime
This commit is contained in:
parent
cafced2917
commit
54703852e7
20 changed files with 1119 additions and 164 deletions
25
include/TickSystem.hpp
Normal file
25
include/TickSystem.hpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
|
||||
class TickSystem {
|
||||
private:
|
||||
std::chrono::duration<float> timer{ 0 };
|
||||
std::chrono::duration<float> tickRate;
|
||||
|
||||
public:
|
||||
TickSystem(std::chrono::duration<float> tickRateSeconds)
|
||||
: tickRate(tickRateSeconds) {
|
||||
}
|
||||
|
||||
bool update(std::chrono::duration<float> deltaTime) {
|
||||
timer += deltaTime;
|
||||
|
||||
if (timer >= tickRate) {
|
||||
timer -= tickRate;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue