class

Opal::Game::Loop

Inherits Reference < Object

High-performance 60Hz fixed-timestep game loop implementing Glenn Fiedler's "Fix Your Timestep" architecture. Decouples physics/simulation updates from variable-rate terminal frame rendering with interpolation.

Constructors

new(target_fps : Int32 = 60, tick_rate : Int32 = 60)
Source

Instance methods

frame_time_ms
Source
on_render
Source
on_update
Source
pause
Source
paused=(paused : Bool)
Source
paused?
Source
resume
Source
run(buffer : UI::Buffer, max_frames : Int32 | Nil = nil) : Nil

Runs the main loop synchronously until stop is invoked or max_frames is reached

Source
running=(running : Bool)
Source
running?
Source
stop
Source
target_fps
Source
target_fps=(target_fps : Int32)
Source
tick_once(dt : Float64 | Nil = nil) : Nil

Performs a single fixed-timestep update tick (useful for headless testing and step debugging)

Source
tick_rate
Source
tick_rate=(tick_rate : Int32)
Source
total_frames
Source