blinksy_desktop/lib.rs
1//! # Blinksy Desktop Simulation
2//!
3//! This crate provides a desktop simulation environment for the Blinksy LED control library.
4//! It allows you to visualize LED layouts and patterns in a 3D graphical window,
5//! making development and testing possible without physical LED hardware.
6//!
7//! ## Usage
8//!
9//! ```rust,no_run
10//! use blinksy::{
11//! ControlBuilder,
12//! layout2d,
13//! layout::{Shape2d, Vec2},
14//! patterns::rainbow::{Rainbow, RainbowParams}
15//! };
16//! use blinksy_desktop::{driver::Desktop, time::elapsed_in_ms};
17//!
18//! // Define your layout
19//! layout2d!(
20//! Layout,
21//! [Shape2d::Grid {
22//! start: Vec2::new(-1., -1.),
23//! row_end: Vec2::new(1., -1.),
24//! col_end: Vec2::new(-1., 1.),
25//! row_pixel_count: 16,
26//! col_pixel_count: 16,
27//! serpentine: true,
28//! }]
29//! );
30//!
31//! // Create a control using the Desktop driver instead of physical hardware
32//! let mut control = ControlBuilder::new_2d()
33//! .with_layout::<Layout>()
34//! .with_pattern::<Rainbow>(RainbowParams::default())
35//! .with_driver(Desktop::new_2d::<Layout>())
36//! .build();
37//!
38//! // Run your normal animation loop
39//! loop {
40//! control.tick(elapsed_in_ms()).unwrap();
41//! std::thread::sleep(std::time::Duration::from_millis(16));
42//! }
43//! ```
44
45/// Desktop LED simulation
46pub mod driver;
47
48/// Time utilities
49pub mod time;