show selected file

This commit is contained in:
2025-11-17 16:13:33 -07:00
parent ccf4499f89
commit 55347be232
3 changed files with 16 additions and 6 deletions

View File

@@ -34,10 +34,7 @@ use crate::{
abi::{KEY_CACHE, MS_SINCE_LAUNCH},
audio::audio_handler,
display::{FRAMEBUFFER, display_handler, init_display},
peripherals::{
conf_peripherals,
keyboard::{KeyState, read_keyboard_fifo},
},
peripherals::{conf_peripherals, keyboard::read_keyboard_fifo},
scsi::MSC_SHUTDOWN,
storage::{SDCARD, SdCard},
ui::{SELECTIONS, clear_selection, ui_handler},

View File

@@ -144,5 +144,11 @@ pub fn draw_text_center<'a, S>(
where
S: TextRenderer<Color = <Display as DrawTarget>::Color>,
{
Text::with_alignment(text, Point::zero(), style, Alignment::Center).draw(display)
Text::with_alignment(
text,
display.bounding_box().center(),
style,
Alignment::Center,
)
.draw(display)
}

View File

@@ -52,7 +52,7 @@ pub fn main() {
SelectionUiError::SelectionListEmpty => {
draw_text_center(
&mut display,
"No Wavs were found in /gifs",
"No Wavs were found in /music",
MonoTextStyle::new(&FONT_6X10, Rgb565::RED),
)
.expect("Display Error");
@@ -64,6 +64,13 @@ pub fn main() {
assert!(selection.is_some());
draw_text_center(
&mut display,
&format!("Now playing {}", wavs[selection.unwrap()]),
MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE),
)
.expect("Display Error");
let file_name = format!("/music/{}", wavs[selection.unwrap()]);
let file = File::new(String::from(file_name));
let mut wav = Wav::new(file).unwrap();