class
Opal::Game::Loop
- Opal::Game::Loop
- Reference
- Object
Overview
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.
Defined in:
opal/game/loop.crConstructors
Instance Method Summary
- #fps : Float64
- #frame_time_ms : Float64
- #on_render(&block : UI::Buffer, Float64 -> Nil) : self
- #on_update(&block : Float64 -> Nil) : self
- #pause : Nil
- #paused=(paused : Bool)
- #paused? : Bool
- #resume : Nil
-
#run(buffer : UI::Buffer, max_frames : Int32 | Nil = nil) : Nil
Runs the main loop synchronously until stop is invoked or max_frames is reached
- #running=(running : Bool)
- #running? : Bool
- #stop : Nil
- #target_fps : Int32
- #target_fps=(target_fps : Int32)
-
#tick_once(dt : Float64 | Nil = nil) : Nil
Performs a single fixed-timestep update tick (useful for headless testing and step debugging)
- #tick_rate : Int32
- #tick_rate=(tick_rate : Int32)
- #total_frames : UInt64
- #ups : Float64
Constructor Detail
Instance Method Detail
Runs the main loop synchronously until stop is invoked or max_frames is reached
def tick_once(dt : Float64 | Nil = nil) : Nil
#
Performs a single fixed-timestep update tick (useful for headless testing and step debugging)