[][src]Function peach::run::run

pub fn run<DrawFn>(draw: DrawFn, config: Config) -> ! where
    DrawFn: 'static + Fn(&mut Sketch, &State), 

Run a sketch, provided a draw callback and a configuration.

Usage

use peach::prelude::*;

fn main() {
    peach::run(draw, Config::default());
}

fn draw(sketch: &mut Sketch, state: State) {
    sketch.clear(0x282A36FF);

    sketch.rotate(state.frame as f32 / 1000.0);

    sketch.anchor(Anchor::Center);
    sketch.fill(Color::RED);
    sketch.rect(state.cursor, [100.0, 100.0]);
}