Macro adi::main

source ·
macro_rules! main {
    ($ctx_type:ty, $ctx_def:item) => { ... };
}
Expand description

Create the main function.

#[macro_use]
extern crate adi;

use adi::App;

main!(
    Ctx,
    struct Ctx {
        mode: fn(app: &mut Ctx),
    }
);

impl App for Ctx {
    fn new() -> Ctx {
        Ctx {
            mode: mode,
        }
    }

    fn run(&mut self) {
        (self.mode)(self)
    }
}

fn mode(app: &mut App, _ctx: &mut Ctx, _runner: &mut Runner<Ctx>, event: Event, _dt: f32) {
    // Your code.
}