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 0000000..63db595 Binary files /dev/null and b/assets/icons.png differ 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,