sortiva/include/TickSystem.hpp
noffie a89b27d456
v1.0 (#1)
* init rework

* Update LICENSE

* removing tests

* adding Gui Component system

* added spdlog library

* Fixed input restriction bug

* nothing

* Making the default button stand out

* Setting up run Component

* changing components

* restarted because i cant do it
visualising sorting through value/step diagrams

* g

* working (kinda)

* fixed sqrt comp error

* added debug flag

* abbandoning Lua... Error in runtime

* fixing errors, making cuts

* removing unnessecary dependencies

* Improving UI
2025-01-11 04:18:48 +01:00

25 lines
437 B
C++

#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;
}
};