Expand description
Interactive visual applications in Rust.
use sketchbook::*;
use sketchbook::ream::Single;
#[apply(derive_sketch)]
#[sketch(
env = minimal,
aspects = (/* aspects go here */),
)]
struct App {
#[page] page: minimal::Page,
}
impl Setup for App {
fn setup(page: minimal::Page, _: ()) -> Self {
Self { page }
}
}
fn main() {
Book::<Single<App>>::bind();
}§Environments
| Crate | Description | Status |
|---|---|---|
| sketchbook-wgpu | Directly uses winit and wgpu to run sketches. | In Development |
| sketchbook-web | Runs sketches in a web browser. | Planned |
| sketchbook-avr | Runs sketches on AVR micro-controllers (E.g. AVR based Arduinos) | Planned |
§Feature Flags
default— No features are enabled by default.
§Optional Components
§Aspects
aspect-update— Aspect that periodically updates a sketch.aspect-keyboard— Aspect for keyboard input.aspect-mouse— Aspect for mouse input.aspect-draw— Aspect for drawing onto the environment’s page.
§Reams
ream-concurrent— Ream that runs multiple sketches without threads.ream-parallel— Ream that runs multiple sketches on independant threads.ream-single— Ream that runs a single sketch.
§Environments
env-aspect-test— Macro for generating environments to test aspects.env-minimal— Minimal environment that implements no aspects.
§Optional Dependencies
std— Support for using the standard library.alloc— Support for using allocation.derive— Re-exportmacro_rules_attributefor better macro syntax.color— Support forpalettebased colors.serde— Support for serde.
Modules§
- aspects
- Built-in aspects of environments.
- compose
- Traits for generic composition.
- minimal
env-minimal - Minimal environment for use in examples and tests.
- ream
- Built-in reams to run sketches.
Macros§
- compose
- Create type composed of other types.
- derive_
sketch - Implements the
Sketchtrait for a struct. - env_
for_ aspect env-aspect-test - Macro to create environment for testing a single aspect.
Structs§
- Book
- A set of sketches.
- Pages
- Pages of a book.
- Point2
- 2D point (x, y)
- Size2
- 2D size (width, height)
- Vector2
- 2D vector (x, y)
Enums§
- Status
- Status flag
Traits§
- Environment
- Environment for sketches to run in and interact with.
- Mill
- Factory for creating pages from an environment.
- Page
- Trait for environment page.
- Real
- Trait for real numbers.
- Setup
- Trait for setting up a sketch given some input.
- Sketch
- Base trait for all sketches.
- ToReal
- Convert to real number.
Type Aliases§
- EventOf
- Helper to get
Eventof type implementing theEnvironmenttrait. - MillOf
- Helper to get
Millof type implementing theEnvironmenttrait. - PageOf
- Helper to get
Pageof type implementing theEnvironmenttrait.
Attribute Macros§
- apply
- Re-export of
macro_rules_attribute’sapplymacro.