stdlib/gameloopView source ↗
gameloop
12 items · generated by scribe fromstdlib/gameloop.fd· synced 2026-11-15
Contents
- GameLoop (struct)
- gameloop_create (function)
- gameloop_step (function)
- gameloop_stop (function)
- gameloop_fps (function)
- gameloop_dt (function)
- gameloop_total_frames (function)
- gameloop_alpha (function)
- SimpleLoop (struct)
- simpleloop_create (function)
- simpleloop_step (function)
- simpleloop_stop (function)
GameLoop
pub struct GameLoop {Fields:
| Name | Type |
|---|---|
target_fps | i64 |
fixed_dt | f64 |
running | bool |
accumulator | f64 |
current_time | i64 |
frame_count | i64 |
fps | i64 |
fps_timer | i64 |
max_frame_time | f64 |
total_frames | i64 |
Defined at line 27
gameloop_create
Create a game loop targeting the given FPS.
pub fn gameloop_create(target_fps: i64) -> GameLoop {Parameters:
target_fps:i64
Returns: GameLoop
Defined at line 50
gameloop_step
Advance the game loop by one frame. Returns the number of fixed updates to run this frame (0 or more). The caller should run fixed_update() that many times, then render once.
pub fn gameloop_step(gl: & mut GameLoop) -> i64 {Parameters:
gl:& mut GameLoop
Returns: i64
Defined at line 63
gameloop_stop
Stop the game gl.
pub fn gameloop_stop(gl: & mut GameLoop) -> void {Parameters:
gl:& mut GameLoop
Returns: void
Defined at line 95
gameloop_fps
Get the current FPS (frames per second).
pub fn gameloop_fps(gl: & GameLoop) -> i64 {Parameters:
gl:& GameLoop
Returns: i64
Defined at line 100
gameloop_dt
Get the fixed timestep in seconds.
pub fn gameloop_dt(gl: & GameLoop) -> f64 {Parameters:
gl:& GameLoop
Returns: f64
Defined at line 105
gameloop_total_frames
Get total elapsed frames since the loop started.
pub fn gameloop_total_frames(gl: & GameLoop) -> i64 {Parameters:
gl:& GameLoop
Returns: i64
Defined at line 110
gameloop_alpha
Get the interpolation factor for rendering (0.0 to 1.0). This is the fraction of the way between the last fixed update and the next. Use it to interpolate physics state for smooth rendering.
pub fn gameloop_alpha(gl: & GameLoop) -> f64 {Parameters:
gl:& GameLoop
Returns: f64
Defined at line 117
SimpleLoop
pub struct SimpleLoop {Fields:
| Name | Type |
|---|---|
running | bool |
current_time | i64 |
dt | f64 |
frame_count | i64 |
fps | i64 |
fps_timer | i64 |
Defined at line 129
simpleloop_create
pub fn simpleloop_create() -> SimpleLoop {Returns: SimpleLoop
Defined at line 139
simpleloop_step
Advance the simple gl. Returns dt in seconds.
pub fn simpleloop_step(sl: & mut SimpleLoop) -> f64 {Parameters:
sl:& mut SimpleLoop
Returns: f64
Defined at line 146
simpleloop_stop
pub fn simpleloop_stop(sl: & mut SimpleLoop) -> void {Parameters:
sl:& mut SimpleLoop
Returns: void
Defined at line 168
Generated by scribe, the Fides documentation generator