From db2437955819105dbd240b95d6b375d5f11a8752 Mon Sep 17 00:00:00 2001 From: KikooDX Date: Wed, 26 May 2021 00:29:23 +0200 Subject: [PATCH] fancy icons --- CMakeLists.txt | 1 + assets/fxconv-metadata.txt | 3 +++ assets/icons.png | Bin 0 -> 530 bytes include/bar.h | 13 +++++++++---- src/bar/draw.c | 3 +++ src/bar/init.c | 1 + 6 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 assets/icons.png diff --git a/CMakeLists.txt b/CMakeLists.txt index 973be80..f9c1024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ set(SOURCES set(ASSETS assets/background.png assets/bar3.png + assets/icons.png ) set(FLAGS diff --git a/assets/fxconv-metadata.txt b/assets/fxconv-metadata.txt index 8097661..22fb8f1 100644 --- a/assets/fxconv-metadata.txt +++ b/assets/fxconv-metadata.txt @@ -5,3 +5,6 @@ background.png: bar3.png: type: bopti-image name: bimg_bar3 +icons.png: + type: bopti-image + name: bimg_icons diff --git a/assets/icons.png b/assets/icons.png new file mode 100644 index 0000000000000000000000000000000000000000..63db59538b3e58b59b7e853a6fd660283e681ddf GIT binary patch literal 530 zcmV+t0`2{YP)Icy05}Epiw)9tsw>+zP3!`zy9{q*!_@UUBd&WJ$kAV`El^%Hu@s?*b?}+hs zZuHTN)x0CdIgdZ@n3u1r&4oLN$NmxPr~6h;pJ5y~MOwxvcge_|AsX2iDc*6X9I~^` z9c6i4Lp2pL+5%Gx3l86_$!J+i=VKC5}3;>37^9ljEk6{I*KlOeKwwH>0dr$l81 z+S0#Z-SS?rM}LQSd1r0e*JdAo7W`OzN4Dgya3&wHU=>eW`USiBtmd5|9(g5yk9OQ2 zO?z>G{1~g_E_?LvVDKLw)X U7y~Lk9{>OV07*qoM6N<$f|vaIAOHXW literal 0 HcmV?d00001 diff --git a/include/bar.h b/include/bar.h index b96a72c..01d5385 100644 --- a/include/bar.h +++ b/include/bar.h @@ -2,13 +2,18 @@ #include extern bopti_image_t bimg_bar3; +extern bopti_image_t bimg_icons; -#define BAR_WIDTH 16 -#define BAR_Y 48 -#define BAR_HEIGHT (DHEIGHT - BAR_Y - 16) -#define BAR_BASE_FILL 0.5 +#define BAR_WIDTH 16 +#define BAR_Y 48 +#define BAR_HEIGHT (DHEIGHT - BAR_Y - 16) +#define BAR_BASE_FILL 0.5 +#define BAR_ICON_HEIGHT 16 +#define BAR_ICON_WIDTH 16 +#define BAR_ICON_Y (BAR_Y - BAR_ICON_HEIGHT - 16) struct Bar { + int id; int x; int y; int height; diff --git a/src/bar/draw.c b/src/bar/draw.c index 8ec340a..a80bef3 100644 --- a/src/bar/draw.c +++ b/src/bar/draw.c @@ -22,4 +22,7 @@ bar_draw(struct Bar bar) for (i = high_y + bar.limit_height; i < low_y; i += 1) dsubimage(bar.x, i, &bimg_bar3, 0, bar.limit_height, bimg_bar3.width, 1, DIMAGE_NOCLIP); + /* draw icons */ + dsubimage(bar.x, BAR_ICON_Y, &bimg_icons, BAR_ICON_WIDTH * bar.id, 0, + BAR_ICON_WIDTH, BAR_ICON_HEIGHT, DIMAGE_NOCLIP); } diff --git a/src/bar/init.c b/src/bar/init.c index 1297c9d..020e93f 100644 --- a/src/bar/init.c +++ b/src/bar/init.c @@ -23,6 +23,7 @@ bar_init(enum BarID bar_id) } return (struct Bar){ + .id = bar_id, .x = x, .y = BAR_Y, .height = BAR_HEIGHT,