25 lines
661 B
C
25 lines
661 B
C
#include "bar.h"
|
|
#include <gint/display.h>
|
|
|
|
extern bopti_image_t *vimg_bar3;
|
|
|
|
void
|
|
bar_draw(struct Bar bar)
|
|
{
|
|
const int height = bar.fill * (float)bar.height;
|
|
const int low_y = bar.y + bar.height;
|
|
const int high_y = bar.y + bar.height - height;
|
|
|
|
/* draw borders */
|
|
drect_border(bar.x, bar.y - 1, bar.x + BAR_WIDTH - 1, low_y + 1,
|
|
C_WHITE, 1, C_BLACK);
|
|
|
|
/* draw fill */
|
|
drect(bar.x + 1, high_y, bar.x + BAR_WIDTH - 2, low_y, C_RGB(31, 8, 5));
|
|
|
|
/* draw icons */
|
|
dsubimage(bar.x + (BAR_WIDTH - BAR_ICON_WIDTH) / 2, BAR_ICON_Y,
|
|
&bimg_icons, BAR_ICON_WIDTH * bar.id, 0, BAR_ICON_WIDTH,
|
|
BAR_ICON_HEIGHT, DIMAGE_NOCLIP);
|
|
}
|