1use blinksy::{
2 layout::{Shape2d, Vec2},
3 layout2d,
4 patterns::rainbow::{Rainbow, RainbowParams},
5 ControlBuilder,
6};
7use blinksy_desktop::{
8 driver::{Desktop, DesktopError},
9 time::elapsed_in_ms,
10};
11use std::{thread::sleep, time::Duration};
12
13layout2d!(
14 PanelLayout,
15 [Shape2d::Grid {
16 start: Vec2::new(-1., -1.),
17 horizontal_end: Vec2::new(1., -1.),
18 vertical_end: Vec2::new(-1., 1.),
19 horizontal_pixel_count: 16,
20 vertical_pixel_count: 16,
21 serpentine: true,
22 }]
23);
24
25fn main() {
26 Desktop::new_2d::<PanelLayout>().start(|driver| {
27 let mut control = ControlBuilder::new_2d()
28 .with_layout::<PanelLayout>()
29 .with_pattern::<Rainbow>(RainbowParams {
30 ..Default::default()
31 })
32 .with_driver(driver)
33 .build();
34
35 loop {
36 if let Err(DesktopError::WindowClosed) = control.tick(elapsed_in_ms()) {
37 break;
38 }
39
40 sleep(Duration::from_millis(16));
41 }
42 });
43}