~irimi1/nannou-experiments

0a375e53933b9eeec8f4788b592fcc2a649e0d1a — Manuel Groß 1 year, 4 months ago f85a888
unu: Make example into a simple sketch
1 files changed, 9 insertions(+), 14 deletions(-)

M fiddling/unu/src/main.rs
M fiddling/unu/src/main.rs => fiddling/unu/src/main.rs +9 -14
@@ 1,23 1,18 @@
/* https://guide.nannou.cc/getting_started/create_a_project.html */
/* https://guide.nannou.cc/tutorials/basics/draw-a-sketch.html */

use nannou::prelude::*;

fn main() {
    nannou::app(model)
        .update(update)
        .simple_window(view)
        .run();
    nannou::sketch(view).run();
}

struct Model {}
fn view(app: &App, frame: Frame){
    // get canvas to draw on
    let draw = app.draw();

fn model(_app: &App) -> Model {
    Model {}
}

fn update(_app: &App, _model: &mut Model, _update: Update) {
}
    // set background to blue
    draw.background().color(PURPLE);

fn view(_app: &App, _model: &Model, frame: Frame){
    frame.clear(PURPLE);
    // put everything on the frame
    draw.to_frame(app, &frame).unwrap();
}