Skip to main content

Game

Trait Game 

Source
pub trait Game: Sized + 'static {
    // Required methods
    fn init() -> Result<Self, String>;
    fn frame(&mut self);

    // Provided method
    fn exit(&mut self) { ... }
}
Expand description

A gasm game. init runs once; frame runs at the configured frame rate.

Required Methods§

Source

fn init() -> Result<Self, String>

Source

fn frame(&mut self)

Provided Methods§

Source

fn exit(&mut self)

Called (best effort) when the player closes the game: flush saves here. Not called after gasm::exit, a trap, or a crash, so also save periodically.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§