61 lines
1.6 KiB
Rust
61 lines
1.6 KiB
Rust
use crate::{display::primary_lcd::PrimaryLcdDisplay, navigation::inputs::Inputs};
|
|
|
|
use alloc::format;
|
|
use embedded_graphics::mono_font::MonoTextStyle;
|
|
use embedded_graphics::mono_font::ascii::FONT_6X10;
|
|
use embedded_graphics::pixelcolor::Rgb565;
|
|
use embedded_graphics::prelude::Point;
|
|
use embedded_graphics::prelude::RgbColor;
|
|
use embedded_graphics::text::Text;
|
|
use embedded_graphics::{Drawable, geometry::Size, primitives::Rectangle};
|
|
use embedded_graphics_core::draw_target::DrawTarget;
|
|
|
|
pub const MAX_SELECTED: i8 = 3;
|
|
|
|
pub struct MainMenu {
|
|
pub selected: i8,
|
|
}
|
|
|
|
impl MainMenu {
|
|
pub async fn display(&self, display: &mut PrimaryLcdDisplay<'static>) {
|
|
let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE);
|
|
let selected_style = MonoTextStyle::new(&FONT_6X10, Rgb565::BLUE);
|
|
|
|
Text::new(
|
|
&format!("Last card"),
|
|
Point::new(20, 240),
|
|
if self.selected == 0 {
|
|
selected_style
|
|
} else {
|
|
style
|
|
},
|
|
)
|
|
.draw(display)
|
|
.unwrap();
|
|
|
|
Text::new(
|
|
&format!("Journal"),
|
|
Point::new(20, 250),
|
|
if self.selected == 1 {
|
|
selected_style
|
|
} else {
|
|
style
|
|
},
|
|
)
|
|
.draw(display)
|
|
.unwrap();
|
|
|
|
Text::new(
|
|
&format!("Settings"),
|
|
Point::new(20, 260),
|
|
if self.selected == 1 {
|
|
selected_style
|
|
} else {
|
|
style
|
|
},
|
|
)
|
|
.draw(display)
|
|
.unwrap();
|
|
}
|
|
}
|