mirror of
https://github.com/LegitCamper/picocalc-os-rs.git
synced 2025-12-27 07:45:28 +00:00
show selected file
This commit is contained in:
@@ -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},
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user