Struct anima_engine::game::MrubyGame [] [src]

pub struct MrubyGame {
    pub mruby: MrubyType,
    pub game: Value,
}

A struct used to run games from mruby directly.

Make sure you point to an mruby file with a Game Class defined which implements a method update(dt), where dt is a Float representing the time since the last frame.

Examples

let game = MrubyGame::new(Path::new("game.rb"));

GameLoop::new(game).run();

Fields

mruby
game

Methods

impl MrubyGame

fn new(script: &Path) -> MrubyGame

Creates a new MrubyGame from an mruby script.

Make sure you point to an mruby file with a Game Class defined which implements a method update(dt), where dt is a Float representing the time since the last frame.

Examples

let game = MrubyGame::new(Path::new("game.rb"));

GameLoop::new(game).run();

Trait Implementations

impl Game for MrubyGame

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