Trait anima_engine::game::Game [] [src]

pub trait Game {
    fn update(&self, dt: Duration) -> bool;
}

A trait runnable within a GameLoop. dt is the Duration since last frame. update should return the boolean value of whether the game should continue.

Examples

pub struct MyGame;

impl Game for MyGame {
    fn update(&self, dt: Duration) -> bool {
        // Update game state.
        // Return `false` when game needs to stop.
        false
    }
}

GameLoop::new(MyGame);

Required Methods

fn update(&self, dt: Duration) -> bool

Implementors