Skip to content

stdlib/gameloopView source ↗

gameloop

12 items · generated by scribe fromstdlib/gameloop.fd· synced 2026-11-15

stdlib/gameloop12 items

Contents

GameLoop

pub struct GameLoop {

Fields:

NameType
target_fpsi64
fixed_dtf64
runningbool
accumulatorf64
current_timei64
frame_counti64
fpsi64
fps_timeri64
max_frame_timef64
total_framesi64

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:

NameType
runningbool
current_timei64
dtf64
frame_counti64
fpsi64
fps_timeri64

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