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::{Layout2d, 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//!     PanelLayout,
21//!     [Shape2d::Grid {
22//!         start: Vec2::new(-1., -1.),
23//!         horizontal_end: Vec2::new(1., -1.),
24//!         vertical_end: Vec2::new(-1., 1.),
25//!         horizontal_pixel_count: 16,
26//!         vertical_pixel_count: 16,
27//!         serpentine: true,
28//!     }]
29//! );
30//!
31//! // Create the Desktop simulator
32//! Desktop::new_2d::<PanelLayout>().start(|driver| {
33//!     // Create a control using the desktop driver instead of physical hardware
34//!     let mut control = ControlBuilder::new_2d()
35//!         .with_layout::<PanelLayout, { PanelLayout::PIXEL_COUNT }>()
36//!         .with_pattern::<Rainbow>(RainbowParams::default())
37//!         .with_driver(driver)
38//!         .with_frame_buffer_size::<{ PanelLayout::PIXEL_COUNT }>()
39//!         .build();
40//!
41//!     // Run your normal animation loop
42//!     loop {
43//!         control.tick(elapsed_in_ms()).unwrap();
44//!
45//!         // Sleep on every frame (16 ms per frame ~= 60 frames per second)
46//!         std::thread::sleep(std::time::Duration::from_millis(16));
47//!     }
48//! });
49//! ```
50
51/// Desktop LED simulation
52pub mod driver;
53
54/// Time utilities
55pub mod time;