From 2088babd5e1cfc55b4ebe6ca38bd9f4869095166 Mon Sep 17 00:00:00 2001 From: tpltnt <1172976+tpltnt@users.noreply.github.com> Date: Mon, 23 Mar 2020 19:48:59 +0100 Subject: [PATCH 1/8] explaining sketch().run() --- src/developer_reference.md | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/developer_reference.md b/src/developer_reference.md index 5d70dc4..92147ae 100644 --- a/src/developer_reference.md +++ b/src/developer_reference.md @@ -4,3 +4,50 @@ developers. Describes the layout of modules, how to navigate the reference, the scope of the main nannou crate i.e. the kinds of work that should go inside the main repo and the kinds that might be better off in separate repos, etc. + +# Updating old code + +Sometimes you have to touch old code and make it work in a new environment. +This sections helps you deal with problems you might encounter. + +In general it helps to read all the CHANGELOG files from your (old) source +version to the target you want to upgrade to. + + +## Sketches don't run + +Your old code looks like this: +``` +extern crate nannou; +use nannou::prelude::*; + +fn main() { + nannou::sketch(view); +} + +fn view(_app: &App, _frame: Frame) { + // the sketch code +} +``` + +Nannou 0.13 introduced a change to allow the user to specify the size of the sketch in this way +``` +nannou::sketch(view).size(width, height).run() +``` + +This required changing the `sketch()` function to return a builder type rather than running immediately (as done in the past). +Specifying the size of a window in the view function felt awkward (and caused a panic on Windows after a winit update). + +Adding `.run()` after the sketch function should display the sketch again. +``` +extern crate nannou; +use nannou::prelude::*; + +fn main() { + nannou::sketch(view).run(); +} + +fn view(_app: &App, _frame: Frame) { + // the sketch code +} +``` From 8dca590aec2a4a1b948de7c71205cf3d7e0b9202 Mon Sep 17 00:00:00 2001 From: tpltnt <1172976+tpltnt@users.noreply.github.com> Date: Tue, 24 Mar 2020 18:23:50 +0100 Subject: [PATCH 2/8] deprecated with_dimension() --- src/developer_reference.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/developer_reference.md b/src/developer_reference.md index 92147ae..c594e2a 100644 --- a/src/developer_reference.md +++ b/src/developer_reference.md @@ -51,3 +51,16 @@ fn view(_app: &App, _frame: Frame) { // the sketch code } ``` + +## Window sizing does not work / with_dimension is gone + +If you have code like +``` +new_window().with_dimension(600,600) +``` +won't work after 0.13.1 + +Use `size()` in this manner: +``` +new_window().size(600, 600) +``` From a1cc9e6e943c053d6b4361e0fc57b37326cc1608 Mon Sep 17 00:00:00 2001 From: tpltnt <1172976+tpltnt@users.noreply.github.com> Date: Tue, 24 Mar 2020 19:51:46 +0100 Subject: [PATCH 3/8] cleaned developer reference (as to be used for documenting internals) --- src/developer_reference.md | 60 -------------------------------------- 1 file changed, 60 deletions(-) diff --git a/src/developer_reference.md b/src/developer_reference.md index c594e2a..5d70dc4 100644 --- a/src/developer_reference.md +++ b/src/developer_reference.md @@ -4,63 +4,3 @@ developers. Describes the layout of modules, how to navigate the reference, the scope of the main nannou crate i.e. the kinds of work that should go inside the main repo and the kinds that might be better off in separate repos, etc. - -# Updating old code - -Sometimes you have to touch old code and make it work in a new environment. -This sections helps you deal with problems you might encounter. - -In general it helps to read all the CHANGELOG files from your (old) source -version to the target you want to upgrade to. - - -## Sketches don't run - -Your old code looks like this: -``` -extern crate nannou; -use nannou::prelude::*; - -fn main() { - nannou::sketch(view); -} - -fn view(_app: &App, _frame: Frame) { - // the sketch code -} -``` - -Nannou 0.13 introduced a change to allow the user to specify the size of the sketch in this way -``` -nannou::sketch(view).size(width, height).run() -``` - -This required changing the `sketch()` function to return a builder type rather than running immediately (as done in the past). -Specifying the size of a window in the view function felt awkward (and caused a panic on Windows after a winit update). - -Adding `.run()` after the sketch function should display the sketch again. -``` -extern crate nannou; -use nannou::prelude::*; - -fn main() { - nannou::sketch(view).run(); -} - -fn view(_app: &App, _frame: Frame) { - // the sketch code -} -``` - -## Window sizing does not work / with_dimension is gone - -If you have code like -``` -new_window().with_dimension(600,600) -``` -won't work after 0.13.1 - -Use `size()` in this manner: -``` -new_window().size(600, 600) -``` From 1811d21d21724be2bdf132443c5a784f10bcc5e0 Mon Sep 17 00:00:00 2001 From: tpltnt <1172976+tpltnt@users.noreply.github.com> Date: Tue, 24 Mar 2020 19:53:42 +0100 Subject: [PATCH 4/8] updating code as dedicated section --- src/updating_nannou_code.md | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/updating_nannou_code.md diff --git a/src/updating_nannou_code.md b/src/updating_nannou_code.md new file mode 100644 index 0000000..c921277 --- /dev/null +++ b/src/updating_nannou_code.md @@ -0,0 +1,59 @@ +# Updating old code + +Sometimes you have to touch old code and make it work in a new environment. +This sections helps you deal with problems you might encounter. + +In general it helps to read all the CHANGELOG files from your old source +version to the target you want to upgrade to. + + +## Sketches don't run + +Your old code looks like this: +``` +extern crate nannou; +use nannou::prelude::*; + +fn main() { + nannou::sketch(view); +} + +fn view(_app: &App, _frame: Frame) { + // the sketch code +} +``` + +Nannou 0.13 introduced a change to allow the user to specify the size of the sketch in this way +``` +nannou::sketch(view).size(width, height).run() +``` + +This required changing the `sketch()` function to return a builder type rather than running immediately as done in the past. +Specifying the size of a window in the view function felt awkward and caused a panic on Windows after a winit update. + +Adding `.run()` after the sketch function should display the sketch again. +``` +extern crate nannou; +use nannou::prelude::*; + +fn main() { + nannou::sketch(view).run(); +} + +fn view(_app: &App, _frame: Frame) { + // the sketch code +} +``` + +## Window sizing does not work / with_dimension is gone + +If you have code like +``` +new_window().with_dimension(600,600) +``` +won't work after 0.13.1 + +Use `size()` in this manner: +``` +new_window().size(600, 600) +``` From dad883f1f8625d37d8964c340b80000b5c16acf5 Mon Sep 17 00:00:00 2001 From: tpltnt <1172976+tpltnt@users.noreply.github.com> Date: Tue, 24 Mar 2020 19:55:37 +0100 Subject: [PATCH 5/8] section added to ToC --- src/SUMMARY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 50b9921..a50e459 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -16,6 +16,7 @@ - [Basics - Drawing 2D Shapes](./tutorials/basics/drawing-2d-shapes.md) - [Developer Reference](./developer_reference.md) - [API Reference](./api_reference.md) +- [Updating Old Code](./updating_nannou_code.md) - [Showcases](./showcases.md) [Contributors](./contributors.md) From b573a7b2b3c7434a35a031a135eb5c7a8d36f5d7 Mon Sep 17 00:00:00 2001 From: tpltnt <1172976+tpltnt@users.noreply.github.com> Date: Tue, 24 Mar 2020 19:58:27 +0100 Subject: [PATCH 6/8] author listing updated --- book.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book.toml b/book.toml index 48a46f0..bc39b09 100644 --- a/book.toml +++ b/book.toml @@ -1,6 +1,6 @@ [book] title = "The Nannou Guide" -authors = ["mitchmindtree", "JoshuaBatty", "freesig"] +authors = ["mitchmindtree", "JoshuaBatty", "freesig", "tpltnt"] src = "src" description = "A one-stop shop for Nannou Knowledge!" multilingual = false From dc469c9bbe3d5ab5515b627301a04b11c0295258 Mon Sep 17 00:00:00 2001 From: tpltnt <1172976+tpltnt@users.noreply.github.com> Date: Thu, 26 Mar 2020 21:13:17 +0100 Subject: [PATCH 7/8] updating code as subsection --- src/getting_started/updating.md | 60 +++++++++++++++++++++++++++++++++ src/updating_nannou_code.md | 59 -------------------------------- 2 files changed, 60 insertions(+), 59 deletions(-) delete mode 100644 src/updating_nannou_code.md diff --git a/src/getting_started/updating.md b/src/getting_started/updating.md index f4d0013..79412bc 100644 --- a/src/getting_started/updating.md +++ b/src/getting_started/updating.md @@ -23,3 +23,63 @@ the following: ```bash rustup update ``` + +## Updating old code + +Sometimes you have to touch old code and make it work in a new environment. +This sections helps you deal with problems you might encounter. + +In general it helps to read all the CHANGELOG files from your old source +version to the target you want to upgrade to. + + +### Sketches don't run + +Your old code looks like this: +``` +extern crate nannou; +use nannou::prelude::*; + +fn main() { + nannou::sketch(view); +} + +fn view(_app: &App, _frame: Frame) { + // the sketch code +} +``` + +Nannou 0.13 introduced a change to allow the user to specify the size of the sketch in this way +``` +nannou::sketch(view).size(width, height).run() +``` + +This required changing the `sketch()` function to return a builder type rather than running immediately as done in the past. +Specifying the size of a window in the view function felt awkward and caused a panic on Windows after a winit update. + +Adding `.run()` after the sketch function should display the sketch again. +``` +extern crate nannou; +use nannou::prelude::*; + +fn main() { + nannou::sketch(view).run(); +} + +fn view(_app: &App, _frame: Frame) { + // the sketch code +} +``` + +### Window sizing does not work / with_dimension is gone + +If you have code like +``` +new_window().with_dimension(600,600) +``` +won't work after 0.13.1 + +Use `size()` in this manner: +``` +new_window().size(600, 600) +``` diff --git a/src/updating_nannou_code.md b/src/updating_nannou_code.md deleted file mode 100644 index c921277..0000000 --- a/src/updating_nannou_code.md +++ /dev/null @@ -1,59 +0,0 @@ -# Updating old code - -Sometimes you have to touch old code and make it work in a new environment. -This sections helps you deal with problems you might encounter. - -In general it helps to read all the CHANGELOG files from your old source -version to the target you want to upgrade to. - - -## Sketches don't run - -Your old code looks like this: -``` -extern crate nannou; -use nannou::prelude::*; - -fn main() { - nannou::sketch(view); -} - -fn view(_app: &App, _frame: Frame) { - // the sketch code -} -``` - -Nannou 0.13 introduced a change to allow the user to specify the size of the sketch in this way -``` -nannou::sketch(view).size(width, height).run() -``` - -This required changing the `sketch()` function to return a builder type rather than running immediately as done in the past. -Specifying the size of a window in the view function felt awkward and caused a panic on Windows after a winit update. - -Adding `.run()` after the sketch function should display the sketch again. -``` -extern crate nannou; -use nannou::prelude::*; - -fn main() { - nannou::sketch(view).run(); -} - -fn view(_app: &App, _frame: Frame) { - // the sketch code -} -``` - -## Window sizing does not work / with_dimension is gone - -If you have code like -``` -new_window().with_dimension(600,600) -``` -won't work after 0.13.1 - -Use `size()` in this manner: -``` -new_window().size(600, 600) -``` From 3b1f9544e5475a86e999f96e0f66070019c03e5c Mon Sep 17 00:00:00 2001 From: tpltnt <1172976+tpltnt@users.noreply.github.com> Date: Thu, 26 Mar 2020 21:13:43 +0100 Subject: [PATCH 8/8] removed chapter listing from ToC --- src/SUMMARY.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index a50e459..50b9921 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -16,7 +16,6 @@ - [Basics - Drawing 2D Shapes](./tutorials/basics/drawing-2d-shapes.md) - [Developer Reference](./developer_reference.md) - [API Reference](./api_reference.md) -- [Updating Old Code](./updating_nannou_code.md) - [Showcases](./showcases.md) [Contributors](./contributors.md)