add update function

This commit is contained in:
Zynh0722 2024-02-16 03:54:42 -08:00
parent 2e5adb3952
commit e3a429cfa2

View file

@ -60,6 +60,9 @@ fn event(app: &App, model: &mut Model, event: WindowEvent) {
println!("{:?}", event); println!("{:?}", event);
} }
// Update the state of your application here. By default, this gets called right before `view`.
fn update(_app: &App, _model: &mut Model, _update: Update) {}
// Draw the state of your `Model` into the given `Frame` here. // Draw the state of your `Model` into the given `Frame` here.
fn view(app: &App, model: &Model, frame: Frame) { fn view(app: &App, model: &Model, frame: Frame) {
let canvas = app.draw(); let canvas = app.draw();
@ -72,5 +75,5 @@ fn view(app: &App, model: &Model, frame: Frame) {
} }
fn main() { fn main() {
nannou::app(model).run(); nannou::app(model).update(update).run();
} }