From 71272f110fd00dc65bf5f028781eebb9969819b2 Mon Sep 17 00:00:00 2001 From: quou Date: Tue, 4 Jun 2024 21:53:09 +1000 Subject: Display the artist, album and song name above the album art. --- main.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 3a0ebed..0e6d281 100644 --- a/main.c +++ b/main.c @@ -9,6 +9,9 @@ Player pl; UIButton* play_button; UISlider* seek_slider; UIImageDisplay* cover_image; +UILabel* title_text; +UILabel* album_text; +UILabel* artist_text; void ui_update_play(void) { UI_FREE(play_button->label); @@ -16,7 +19,6 @@ void ui_update_play(void) { pl.play? "Pause": "Play", -1 ); - UIElementRefresh((UIElement*)play_button); UIImageDisplaySetContent( cover_image, pl.cover, @@ -24,7 +26,22 @@ void ui_update_play(void) { album_cover_h, album_cover_w * 4 ); - UIElementRepaint((UIElement*)cover_image, 0); + UILabelSetContent( + title_text, + pl.song->name, + -1 + ); + UILabelSetContent( + album_text, + pl.song->album, + -1 + ); + UILabelSetContent( + artist_text, + pl.song->artist, + -1 + ); + UIElementRefresh(cover_image->e.parent); } void ui_update_seek(void) { @@ -203,6 +220,24 @@ int prog_main(void* mem) { pctrl = UIPanelCreate(&split3->e, UI_PANEL_GRAY); pctrl->gap = 5; pctrl->border = UI_RECT_1(5); + title_text = UILabelCreate( + &pctrl->e, + 0, + "", + -1 + ); + album_text = UILabelCreate( + &pctrl->e, + 0, + "", + -1 + ); + artist_text = UILabelCreate( + &pctrl->e, + 0, + "", + -1 + ); cover_image = UIImageDisplayCreate( &pctrl->e, 0, -- cgit v1.2.3-54-g00ecf