summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-06-04 21:53:09 +1000
committerquou <quou@disroot.org>2024-06-04 21:53:09 +1000
commit71272f110fd00dc65bf5f028781eebb9969819b2 (patch)
tree863248e8f9abac6b97869178a30366239b191486
parent008b4c7b1f589780be0e2624337484c085cacbe0 (diff)
Display the artist, album and song name above the album art.
-rw-r--r--main.c39
1 files 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,