[nvim] Add an app template snippet for Nannou apps (nnapp)
This commit is contained in:
parent
884fa0a542
commit
6b08decfb9
1 changed files with 38 additions and 0 deletions
38
config/nvim/UltiSnips/rust.snippets
Normal file
38
config/nvim/UltiSnips/rust.snippets
Normal file
|
@ -0,0 +1,38 @@
|
|||
# rust.snippets
|
||||
# vim: set ts=8 sw=8 sts=8 noet list:
|
||||
# Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
snippet nnapp
|
||||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
use nannou::prelude::*;
|
||||
|
||||
struct Model {
|
||||
_window: window::Id,
|
||||
}
|
||||
|
||||
impl Model {
|
||||
fn new(app: &App) -> Self {
|
||||
let window = app.new_window().view(view).build().unwrap();
|
||||
Self {
|
||||
_window: window,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(app: &App, model: &mut Model, update: Update) {
|
||||
model.update(app, update)
|
||||
}
|
||||
|
||||
fn update(&mut self, app: &App, update: Update) {
|
||||
// TODO: Update the model here.
|
||||
}
|
||||
}
|
||||
|
||||
fn view(app: &App, model: &Model, frame: Frame) {
|
||||
// TODO: Draw the view here.
|
||||
}
|
||||
|
||||
fn main() {
|
||||
nannou::app(Model::new).update(update).run();
|
||||
}
|
||||
endsnippet
|
Loading…
Add table
Add a link
Reference in a new issue