[][src]Trait ds2d::Game

pub trait Game {
    fn draw(&mut self, ctx: &mut Context) -> GameResult<()>;
fn update(&mut self, ctx: &mut Context) -> GameResult<()>;
fn exit(&mut self, ctx: &mut Context) -> GameResult<()>; }

Implemented by the struct holding the game state.

Required methods

fn draw(&mut self, ctx: &mut Context) -> GameResult<()>

Called every frame when the game should render its state. Returning an error will cause the game to exit.

fn update(&mut self, ctx: &mut Context) -> GameResult<()>

Called every frame when the game should update its state. Returning an error will cause the game to exit.

fn exit(&mut self, ctx: &mut Context) -> GameResult<()>

Called immediately before the game stops. Should free any remaining resources acquired from the context here. The game state will be dropped immediately afterwards.

Loading content...

Implementors

Loading content...