This commit is contained in:
2025-11-05 20:22:26 -07:00
parent f1ec7d8523
commit fe5b2a253e

View File

@@ -39,7 +39,7 @@ pub async fn ui_handler() {
changed: true, changed: true,
}; };
let mut scsi = ScsiPage { last_bounds: None }; let mut scsi = ScsiPage { last_bounds: None };
let overlay = Overlay::new(); let mut overlay = Overlay::new();
update_selections().await; update_selections().await;
loop { loop {
@@ -77,28 +77,31 @@ async fn input_handler(ui: &mut UiState, menu: &mut MenuPage, scsi: &mut ScsiPag
struct Overlay { struct Overlay {
f1_label: &'static str, f1_label: &'static str,
last_bounds: Option<Rectangle>,
} }
impl Overlay { impl Overlay {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
f1_label: "Press F1 to enable/disable mass storage", f1_label: "Press F1 to enable/disable mass storage",
last_bounds: None,
} }
} }
async fn draw(&self) { async fn draw(&mut self) {
let text_style = MonoTextStyle::new(&FONT_4X6, Rgb565::WHITE); let text_style = MonoTextStyle::new(&FONT_4X6, Rgb565::WHITE);
let fb = unsafe { &mut *FRAMEBUFFER.as_mut().unwrap() }; let fb = unsafe { &mut *FRAMEBUFFER.as_mut().unwrap() };
let bounds = fb.bounding_box(); let bounds = fb.bounding_box();
Text::with_alignment( let text = Text::with_alignment(
self.f1_label, self.f1_label,
Point::new(10, bounds.size.height as i32 - 24), // bottom-left corner Point::new(10, bounds.size.height as i32 - 24), // bottom-left corner
text_style, text_style,
Alignment::Left, Alignment::Left,
) );
.draw(fb)
.unwrap(); self.last_bounds = Some(text.bounds());
text.draw(fb).unwrap();
} }
} }