cuqueclicker_lib/ui/
debug_pane.rs1use ratatui::{prelude::*, widgets::*};
2
3pub const DEBUG_KEYS: &[(&str, &str)] = &[
11 ("F8", "Lucky [$]"),
12 ("F2", "Frenzy [!]"),
13 ("F3", "Buff [+]"),
14 ("F4", "+1M cuques"),
15];
16
17pub fn draw(frame: &mut Frame, play_area: Rect) {
18 if play_area.width < 24 || play_area.height < (DEBUG_KEYS.len() as u16 + 3) {
19 return;
20 }
21
22 let w: u16 = 22;
23 let h: u16 = DEBUG_KEYS.len() as u16 + 3; let area = Rect {
26 x: play_area.x,
27 y: play_area.y,
28 width: w,
29 height: h,
30 };
31
32 let mut lines: Vec<Line> = DEBUG_KEYS
33 .iter()
34 .map(|(key, desc)| {
35 Line::from(vec![
36 Span::styled(
37 format!("{:<3}", key),
38 Style::default()
39 .fg(Color::Rgb(255, 200, 90))
40 .add_modifier(Modifier::BOLD),
41 ),
42 Span::raw(" "),
43 Span::styled(*desc, Style::default().fg(Color::Rgb(200, 200, 210))),
44 ])
45 })
46 .collect();
47
48 lines.push(Line::from(Span::styled(
49 "--no-debug: disable",
50 Style::default().fg(Color::Rgb(110, 110, 120)),
51 )));
52
53 let block = Block::bordered()
54 .title(" DEBUG ")
55 .border_style(Style::default().fg(Color::Rgb(180, 140, 60)));
56 let p = Paragraph::new(lines).block(block);
57 frame.render_widget(Clear, area);
58 frame.render_widget(p, area);
59}