getting_started/
getting_started.rs1use fryingpan::{FryingPan, Input, Panel, Point, A_ITALIC, init_pair, COLOR_BLUE, color_pair, COLOR_WHITE};
2use std::{thread::sleep, time::Duration};
3
4const BLUE_WHITE: i16 = 1;
5const SLEEP_TIME: Duration = Duration::from_millis(50);
6
7fn main() {
8 let pancake = FryingPan::default()
10 .hide_cursor(true)
11 .no_delay(true)
12 .color(true)
13 .build()
14 .unwrap();
15 init_pair(BLUE_WHITE, COLOR_BLUE, COLOR_WHITE);
16
17 let mut panel = Panel::new(Point::from(1, 1), 10, 30);
19 panel.draw_box();
20
21 panel.mv_print(Point::from(1, 0), "â•´pancakesâ•¶");
23 panel.mv_print(Point::from(1, 1), "hello");
24
25 panel.attr_on(A_ITALIC).unwrap();
27 panel.attr_on(color_pair(BLUE_WHITE)).unwrap();
28
29 loop {
30 if let Some(Input::Character('q')) = pancake.get_char() {
31 break;
32 }
33
34 pancake.erase();
35 pancake.render_panel(&panel);
36 pancake.refresh();
37
38 sleep(SLEEP_TIME);
39 }
40
41 pancake.quit();
42}