7#include <entt/entt.hpp>
52 [[nodiscard]]
explicit operator bool()
const
150 void tick(
double nowSeconds );
void cancelTimersFor(const Entities::Actor *owner)
Cancels every actor-owned timer registered for owner.
std::function< void()> Callback
Callback type used by unowned timers.
bool isEventStillValid(const TimerEvent &event) const
double getCurrentTimeSeconds() const
std::vector< TimerEvent > timers_
TimerHandle setTimer(double delaySeconds, Callback callback)
Schedules a one-shot callback after delaySeconds.
void clear()
Removes all pending timers without running callbacks.
TimerManager(EngineKern *engine)
Creates an engine-owned timer manager.
void insertTimer(TimerEvent event)
TimerHandle setActorTimer(Entities::Actor *owner, double delaySeconds, std::function< void(Entities::Actor &)> callback)
Schedules a one-shot callback tied to an actor's lifetime.
TimerManager()=default
Creates a standalone timer manager.
void tick(double nowSeconds)
Executes all timers due at or before nowSeconds.
double currentTimeSeconds_
void cancelTimer(TimerHandle handle)
Cancels a scheduled timer.
Owns the engine runtime and provides access to engine subsystems.
An Actor is similar to an Engine::Entities::Entity. An actor is an Entity with a transform.
Opaque identifier for a scheduled timer.