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},
|
abi::{KEY_CACHE, MS_SINCE_LAUNCH},
|
||||||
audio::audio_handler,
|
audio::audio_handler,
|
||||||
display::{FRAMEBUFFER, display_handler, init_display},
|
display::{FRAMEBUFFER, display_handler, init_display},
|
||||||
peripherals::{
|
peripherals::{conf_peripherals, keyboard::read_keyboard_fifo},
|
||||||
conf_peripherals,
|
|
||||||
keyboard::{KeyState, read_keyboard_fifo},
|
|
||||||
},
|
|
||||||
scsi::MSC_SHUTDOWN,
|
scsi::MSC_SHUTDOWN,
|
||||||
storage::{SDCARD, SdCard},
|
storage::{SDCARD, SdCard},
|
||||||
ui::{SELECTIONS, clear_selection, ui_handler},
|
ui::{SELECTIONS, clear_selection, ui_handler},
|
||||||
|
|||||||
@@ -144,5 +144,11 @@ pub fn draw_text_center<'a, S>(
|
|||||||
where
|
where
|
||||||
S: TextRenderer<Color = <Display as DrawTarget>::Color>,
|
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 => {
|
SelectionUiError::SelectionListEmpty => {
|
||||||
draw_text_center(
|
draw_text_center(
|
||||||
&mut display,
|
&mut display,
|
||||||
"No Wavs were found in /gifs",
|
"No Wavs were found in /music",
|
||||||
MonoTextStyle::new(&FONT_6X10, Rgb565::RED),
|
MonoTextStyle::new(&FONT_6X10, Rgb565::RED),
|
||||||
)
|
)
|
||||||
.expect("Display Error");
|
.expect("Display Error");
|
||||||
@@ -64,6 +64,13 @@ pub fn main() {
|
|||||||
|
|
||||||
assert!(selection.is_some());
|
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_name = format!("/music/{}", wavs[selection.unwrap()]);
|
||||||
let file = File::new(String::from(file_name));
|
let file = File::new(String::from(file_name));
|
||||||
let mut wav = Wav::new(file).unwrap();
|
let mut wav = Wav::new(file).unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user