Skip to content

Commit

Permalink
Guide tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tychedelia committed Jun 17, 2024
1 parent b01d4c1 commit 58af6cb
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 242 deletions.
146 changes: 0 additions & 146 deletions bevy_nannou_draw/src/changed.rs

This file was deleted.

1 change: 0 additions & 1 deletion bevy_nannou_draw/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use bevy::prelude::*;

use crate::render::NannouRenderPlugin;

mod changed;
pub mod color;
pub mod draw;
pub mod render;
Expand Down
12 changes: 6 additions & 6 deletions guide/book_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ edition = '2018'
description = 'For testing the nannou-guide, while including the nannou dependencies.'

[build-dependencies]
# Temporarily use git dependency until budziq/rust-skeptic#121 is merged and published.
# https://github.com/budziq/rust-skeptic/pull/121
skeptic = { git = "https://github.com/mitchmindtree/rust-skeptic", branch = "1.45-extern" }
# Temporarily use git dependency until budziq/rust-skeptic#142 is merged and published.
# https://github.com/budziq/rust-skeptic/pull/142
skeptic = { git = "https://github.com/Erk-/rust-skeptic", branch = "fix-rust-1-77" }
#skeptic = "0.13"

[dev-dependencies]
# Temporarily use git dependency until budziq/rust-skeptic#121 is merged and published.
# https://github.com/budziq/rust-skeptic/pull/121
skeptic = { git = "https://github.com/mitchmindtree/rust-skeptic", branch = "1.45-extern" }
# Temporarily use git dependency until budziq/rust-skeptic#142 is merged and published.
# https://github.com/budziq/rust-skeptic/pull/142
skeptic = { git = "https://github.com/Erk-/rust-skeptic", branch = "fix-rust-1-77" }
#skeptic = "0.13"
nannou = { version ="0.19.0", path = "../../nannou" }
nannou_osc = { version ="0.19.0", path = "../../nannou_osc" }
Expand Down
3 changes: 2 additions & 1 deletion guide/src/getting_started/create_a_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ create a new project with just a few small steps:
fn update(_app: &App, _model: &mut Model) {
}
fn view(_app: &App, _model: &Model) {
fn view(app: &App, _model: &Model, _window: Entity) {
let draw = app.draw();
draw.background().color(PURPLE);
}
```
Expand Down
23 changes: 6 additions & 17 deletions guide/src/tutorials/basics/anatomy-of-a-nannou-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct Model {}
fn main() {
nannou::app(model)
.event(event)
.simple_window(view)
.run();
}
Expand All @@ -32,10 +31,7 @@ fn model(_app: &App) -> Model {
Model {}
}
fn event(_app: &App, _model: &mut Model, _event: Event) {
}
fn view(_app: &App, _model: &Model, _frame: Frame) {
fn view(_app: &App, _model: &Model, _window: Entity) {
}
```

Expand Down Expand Up @@ -88,16 +84,13 @@ model can stay empty.
# struct Model {}
fn main() {
nannou::app(model)
.event(event)
.simple_window(view)
.run();
}
# fn model(_app: &App) -> Model {
# Model {}
# }
# fn event(_app: &App, _model: &mut Model, _event: Event) {
# }
# fn view(_app: &App, _model: &Model, _frame: Frame) {
# fn view(_app: &App, _model: &Model, _window: Entity) {
# }
```

Expand All @@ -110,16 +103,13 @@ quite small. In short, we build a description of our app and then run it!
# struct Model {}
# fn main() {
nannou::app(model) // Start building the app and specify our `model`
.event(event) // Specify that we want to handle app events with `event`
.simple_window(view) // Request a simple window to which we'll draw with `view`
.run(); // Run it!
# }
# fn model(_app: &App) -> Model {
# Model {}
# }
# fn event(_app: &App, _model: &mut Model, _event: Event) {
# }
# fn view(_app: &App, _model: &Model, _frame: Frame) {
# fn view(_app: &App, _model: &Model, _window: Entity) {
# }
```

Expand Down Expand Up @@ -195,8 +185,7 @@ will just return an instance of our empty **Model**.
# #![allow(dead_code)]
# use nannou::prelude::*;
# struct Model {}
fn event(_app: &App, _model: &mut Model, _event: Event) {
}
// TODO: Add an event function here!
# fn main() {}
```
Expand Down Expand Up @@ -234,7 +223,7 @@ fn main() {
# }
# fn update(_app: &App, _model: &mut Model) {
# }
# fn view(_app: &App, _model: &Model, _frame: Frame) {
# fn view(_app: &App, _model: &Model, _window: Entity) {
# }
```

Expand Down Expand Up @@ -264,7 +253,7 @@ occurs.
# #![allow(dead_code)]
# use nannou::prelude::*;
# struct Model {}
fn view(_app: &App, _model: &Model, _frame: Frame) {
fn view(_app: &App, _model: &Model, _window: Entity) {
}
# fn main() {}
```
Expand Down
6 changes: 3 additions & 3 deletions guide/src/tutorials/basics/draw-a-sketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ After this import the actual sketching code starts. The `main()` functions is wh
# fn main() {
nannou::sketch(view).run();
# }
# fn view(_app: &App, _frame: Frame) {}
# fn view(_app: &App) {}
```

calls a function to draw on the single window (`view()` in this case). This
Expand Down Expand Up @@ -88,7 +88,7 @@ This function follows the same scheme. First some setup is done. The line
# fn main() {
# nannou::sketch(view).run();
# }
# fn view(app: &App, _frame: Frame) {
# fn view(app: &App) {
let draw = app.draw();
# }
```
Expand All @@ -102,7 +102,7 @@ We can now paint on the this canvas by setting the background to blue.
# fn main() {
# nannou::sketch(view).run();
# }
# fn view(app: &App, _frame: Frame) {
# fn view(app: &App) {
# let draw = app.draw();
draw.background().color(BLUE);
# }
Expand Down
10 changes: 5 additions & 5 deletions guide/src/tutorials/basics/sketch-vs-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn main() {
fn view(app: &App) {
let draw = app.draw();
draw.background().color(PLUM);
draw.ellipse().color(STEELBLUE);
draw.ellipse().color(STEEL_BLUE);
}
```
Expand Down Expand Up @@ -81,7 +81,7 @@ fn update(_app: &App, _model: &mut Model) {}
fn view(app: &App, _model: &Model) {
let draw = app.draw();
draw.background().color(PLUM);
draw.ellipse().color(STEELBLUE);
draw.ellipse().color(STEEL_BLUE);
}
```
Expand Down Expand Up @@ -119,7 +119,7 @@ flexibility, you can turn it into an app by following these steps:
# fn main() {
nannou::sketch(view).run()
# }
# fn view(_: &App, _: Frame) {}
# fn view(_: &App) {}
```
to
Expand All @@ -132,7 +132,7 @@ flexibility, you can turn it into an app by following these steps:
# }
# struct Model {}
# fn model(_: &App) -> Model { Model {} }
# fn view(_: &App, _: &Model, _: Frame) {}
# fn view(_: &App, _: &Model, _: Entity) {}
```

2. Add a `Model` for tracking state:
Expand Down Expand Up @@ -172,7 +172,7 @@ flexibility, you can turn it into an app by following these steps:
# use nannou::prelude::*;
# fn main() {}
# struct Model {}
fn view(app: &App, _model: &Model) {
fn view(app: &App, _model: &Model, _window: Entity) {
# }
```

Expand Down
Loading

0 comments on commit 58af6cb

Please sign in to comment.