nannou/
lib.rs

1#![doc(
2    html_logo_url = "https://raw.githubusercontent.com/nannou-org/nannou/master/assets/images/logo.png"
3)]
4
5//! An open-source creative-coding toolkit for Rust.
6//!
7//! [**Nannou**](http://nannou.cc) is a collection of code aimed at making it easy for artists to
8//! express themselves with simple, fast, reliable, portable code. Whether working on a 12-month
9//! laser installation or a 5 minute sketch, this framework aims to give artists easy access to the
10//! tools they need.
11//!
12//! If you're new to nannou, we recommend checking out [the
13//! examples](https://github.com/nannou-org/nannou/tree/master/examples) to get an idea of how
14//! nannou applications are structured and how the API works.
15
16pub use find_folder;
17pub use lyon;
18pub use winit;
19
20pub use self::app::{App, LoopMode};
21pub use self::draw::Draw;
22pub use self::event::Event;
23pub use self::frame::Frame;
24#[doc(inline)]
25pub use nannou_core::{color, glam, math, rand};
26#[doc(inline)]
27pub use nannou_mesh as mesh;
28#[doc(inline)]
29pub use nannou_wgpu as wgpu;
30
31pub mod app;
32pub mod draw;
33pub mod ease;
34pub mod event;
35pub mod frame;
36pub mod geom;
37pub mod image;
38pub mod io;
39pub mod noise;
40pub mod prelude;
41pub mod state;
42pub mod text;
43pub mod time;
44pub mod window;
45
46/// Begin building the `App`.
47///
48/// The `model` argument is the function that the App will call to initialise your Model.
49///
50/// The Model can be thought of as the state that you would like to track throughout the
51/// lifetime of your nannou program from start to exit.
52///
53/// The given function is called before any event processing begins within the application.
54///
55/// The Model that is returned by the function is the same model that will be passed to the
56/// given event and view functions.
57pub fn app<M: 'static>(model: app::ModelFn<M>) -> app::Builder<M, Event> {
58    app::Builder::new(model)
59}
60
61/// Shorthand for building a simple app that has no model, handles no events and simply draws
62/// to a single window.
63///
64/// This is useful for late night hack sessions where you just don't care about all that other
65/// stuff, you just want to play around with some ideas or make something pretty.
66pub fn sketch(view: app::SketchViewFn) -> app::SketchBuilder<Event> {
67    app::Builder::sketch(view)
68}