KernelAPI reference
Class GameLoop
Namespace: MicroEngine.Core
Assembly: MicroEngine.dll
Guide: Game lifecycle and time
The loop, one frame per Tick. It owns time: the platform only supplies a monotonic clock
(Clock), and the engine’s FrameClock turns each frame’s time into fixed
steps following the game’s TimeSettings (at most MaxStepsPerFrame a frame, frames of at
most MaxFrameDelta). Each frame runs the engine’s frame schedule: the per-frame phases, the four fixed phases
once per step, then the update, drawing and presentation phases. In deterministic time every frame is exactly one
step, which makes scripted runs reproducible. Each frame starts with the platform’s event pump
(PumpEvents), whose events become the engine’s lifecycle events
(IEngineLifecycle) before the frame’s steps. Hosts that cannot block, such as a browser driving
frames from requestAnimationFrame, call Tick themselves; errors are captured, never thrown.
public sealed class GameLoopInheritance
Constructors
GameLoop(Game, IPlatform, RunOptions?)
Prepares a loop; nothing runs until Start.
public GameLoop(Game game, IPlatform platform, RunOptions? options = null)Parameters
game Game
platform IPlatform
options RunOptions?
Exceptions
game or platform is null.
GameLoop(Game, IPlatform, RunOptions?, Action<EngineBuilder>?)
Prepares a loop whose engine also gets the host’s composition: compose runs after the game’s
Configure and before the run’s own systems (GameHost passes the content and engine
changes of its HostBuilder this way).
public GameLoop(Game game, IPlatform platform, RunOptions? options, Action<EngineBuilder>? compose)Parameters
game Game
platform IPlatform
options RunOptions?
compose Action<EngineBuilder>?
Exceptions
game or platform is null.
Properties
Frames
Frames rendered so far.
public long Frames { get; }Property Value
IsRunning
Whether the next Tick will run a frame.
public bool IsRunning { get; }Property Value
Methods
Finish()
Shuts the game down (once) and reports the run.
public RunResult Finish()Returns
Start()
Initializes the game; false when loading failed (the error is in Finish).
public bool Start()Returns
Tick()
Runs one frame. Returns false once the game quit, the platform closed, a limit was hit or an error occurred.
public bool Tick()