rsnaker/graphics/menus/retro_parameter_table/
customized_with_doc.rs1use crate::graphics::menus::retro_parameter_table::generic_logic::{
2 get_default_action_input, CellValue, FooterData, GenericMenu, RowData,
3};
4use ratatui::DefaultTerminal;
5
6pub fn setup_and_run_doc_table_parameters(terminal: &mut DefaultTerminal) {
8 GenericMenu::new(
9 load_doc_info_in_table(),
10 &doc_get_headers(),
11 doc_get_footer_data(),
12 None,
13 )
14 .run(get_default_action_input(), terminal);
15}
16
17#[must_use]
19fn load_doc_info_in_table() -> Vec<RowData> {
20 let rows = vec![
21 RowData::new(vec![
22 CellValue::new("đ¯ Goal".to_string()),
23 CellValue::new("Eat fruits, grow, and score points.".to_string()),
24 ]),
25 RowData::new(vec![
26 CellValue::new("đ Fruits".to_string()),
27 CellValue::new(
28 "Different fruits give various scores and effects.\n\
29 Some can even reduce your size (and score)."
30 .to_string(),
31 ),
32 ]),
33 RowData::new(vec![
34 CellValue::new("đ Speed".to_string()),
35 CellValue::new(
36 "Game speed changes difficulty and score multipliers.\n\
37 See the Speed menu for more details."
38 .to_string(),
39 ),
40 ]),
41 RowData::new(vec![
42 CellValue::new("đŽ Movement".to_string()),
43 CellValue::new("Use â â â to control the snake.".to_string()),
44 ]),
45 RowData::new(vec![
46 CellValue::new("đĨ Collisions".to_string()),
47 CellValue::new("Avoid hitting yourself or your own tail.".to_string()),
48 ]),
49 RowData::new(vec![
50 CellValue::new("đ Walls".to_string()),
51 CellValue::new(
52 "The arena wraps around: going out on one side\n\
53 makes you appear on the opposite side."
54 .to_string(),
55 ),
56 ]),
57 RowData::new(vec![
58 CellValue::new("â¸ī¸ Pause".to_string()),
59 CellValue::new("Press P or Space to pause / resume.".to_string()),
60 ]),
61 RowData::new(vec![
62 CellValue::new("đ New game".to_string()),
63 CellValue::new("Press R to start a new game.".to_string()),
64 ]),
65 RowData::new(vec![
66 CellValue::new("đ Main menu".to_string()),
67 CellValue::new("Press M to return to the main menu.".to_string()),
68 ]),
69 RowData::new(vec![
70 CellValue::new("đĒ Quit".to_string()),
71 CellValue::new("Press Q to quit at any time.".to_string()),
72 ]),
73 ];
74 rows
75}
76
77#[must_use]
79fn doc_get_headers() -> Vec<String> {
80 vec!["đ Topic".to_string(), "âšī¸ Details".to_string()]
81}
82
83#[must_use]
85fn doc_get_footer_data() -> Vec<FooterData> {
86 vec![
87 FooterData {
88 symbol: "Esc".into(),
89 text: "Return to home".into(),
90 value: None,
91 },
92 FooterData {
93 symbol: "â".into(),
94 text: "Move".into(),
95 value: None,
96 },
97 ]
98}