Skip to main content

GameLoop

Trait GameLoop 

Source
pub trait GameLoop {
    type Fb: FbSurface;

    // Required methods
    fn update(&mut self, input: &InputState);
    fn draw(&mut self, frame_buffer: &mut Self::Fb);

    // Provided method
    fn should_exit(&self) -> bool { ... }
}

Required Associated Types§

Source

type Fb: FbSurface

The framebuffer type the game draws into: either the engine’s RGBA [FrameBuffer] (true-color games) or the indexed crate::RgbaIndexedFrameBuffer (fixed-palette games).

Required Methods§

Source

fn update(&mut self, input: &InputState)

Source

fn draw(&mut self, frame_buffer: &mut Self::Fb)

Provided Methods§

Source

fn should_exit(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§