12namespace Imago::Engine
30 static constexpr float DEFAULT_FIXED_TIMESTEP = 1.0f / 60.0f;
31 static constexpr uint32_t DEFAULT_MAX_FIXED_STEPS = 8;
33 float _accumulator = 0.0f;
34 float _fixedTimestep = DEFAULT_FIXED_TIMESTEP;
35 uint32_t _maxFixedSteps = DEFAULT_MAX_FIXED_STEPS;
38 std::vector<SystemFn> _coreSystems;
39 std::vector<SystemFn> _userSystems;
40 std::vector<SystemFn> _fixedSystems;
50 static void add_system(std::vector<SystemFn>& systems,
SystemFn system);
59 static bool remove_system(std::vector<SystemFn>& systems,
SystemFn system);
void register_fixed(SystemFn system)
Registers a fiexed timestep system. Called with the fixed step, not the frame time.
Definition SystemScheduler.cpp:105
void(*)(SceneContext &, float) SystemFn
Function pointer signature for a scheduled system.
Definition SystemScheduler.hpp:26
void tick(float dt)
Runs one frame or fixed step of scheduled systems, called once per frame by the Scene.
Definition SystemScheduler.cpp:18
SystemScheduler(SceneContext &ctx)
Construct a new System Scheduler object.
Definition SystemScheduler.cpp:14
void register_update(SystemFn system)
Registers a user per-frame system.
Definition SystemScheduler.cpp:104
void set_max_fixed_steps(uint32_t maxSteps)
Sets the most fixed steps that can run in one tick, must be greater than 0.
Definition SystemScheduler.cpp:154
void set_user_order(std::vector< SystemFn > order)
Set the user order object based off of a order vector they have arranged in the editor,...
Definition SystemScheduler.cpp:130
void set_fixed_timestep(float timestep)
Sets the fixed step size in seconds, must be greater than 0.
Definition SystemScheduler.cpp:144
void unregister(SystemFn system)
Removes a system from every list it is in.
Definition SystemScheduler.cpp:107
void register_core(SystemFn system)
Registers a core per-frame system that should run before user systems.
Definition SystemScheduler.cpp:103
float get_alpha() const
Returns the fraction of the fiexed step left in the accumulator (0 to <1) (For render interpolation).
Definition SystemScheduler.cpp:166
Gives systems access to the persistent engine objects they could need.
Definition SceneContext.hpp:30