Skip to content
This repository was archived by the owner on Apr 11, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [Basics - Anatomy of a Nannou App](./tutorials/basics/anatomy-of-a-nannou-app.md)
- [Basics - Drawing 2D Shapes](./tutorials/basics/drawing-2d-shapes.md)
- [Developer Reference](./developer_reference.md)
- [Porting From Other Frameworks](./porting_from_other_frameworks.md)
- [API Reference](./api_reference.md)
- [Showcases](./showcases.md)

Expand Down
45 changes: 45 additions & 0 deletions src/porting_from_other_frameworks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Porting from other frameworks

Nannou is inspired by other creative coding frameworks inspired like [Processing](https://processing.org),
[openFrameworks](https://openframeworks.cc), and [Cinder](https://libcinder.org/).
This section is intended to help everyone making the switch to nannou and bringing their code with them.

**note: This is very much a work in progress. It will be extended as we learn about porting issues.**

## General
**This section shall contain general information**

## Processing
Processing has two famous functions. The `setup()` function prepares everything and takes care of
the initial setup. The `draw()` actuallly changes things on the screen.

Most tasks of the `setup()` function in processing are taken care of by the `model()` function in nannou.
This is where the inital state of the world (model) is created. This model information is then processed
later by other functions.

Sometimes the `setup()` function is used to prepare the screen. Sometimes code already draws
in this phase (e.g. to set the background). This behaviour can be emulated using `.nth()`, which
counts the number of frames displayed in the associated window.
```rust
fn view(app: &App, m: &Model, frame: &Frame) {
let draw = app.draw();
if frame.nth() == 0 {
// do one-time preparations of the screen here
}
// general drawing code
draw.to_frame(app, &frame).unwrap();
}
```

The `draw()` function in processing is used to both draw on the screen and also to change the state
of to be displayed. Nannou takes a more explicit approach here. The function `view()` in nannou
displays things. Functions like `update()` or `event()` are used to (only) change the state of the
model to be displayed. Thus there are dedicated places which take care of either showing things
or changing things.


## openFrameworks
**This section shall contain openFrameworks-specific information**

## Cinder
**This section shall contain Cinder-specific information**