Ugly background image

This commit is contained in:
KikooDX 2021-05-24 11:19:21 +02:00
parent de8a218bcc
commit 1f0dc26baa
5 changed files with 35 additions and 10 deletions

View File

@ -18,7 +18,9 @@ set(SOURCES
src/bar/draw.c
)
set(ASSETS)
set(ASSETS
assets/background.png
)
set(FLAGS
-std=c11

BIN
assets/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@ -0,0 +1,4 @@
# gint bopti_image_t
background.png:
type: bopti-image
name: bimg_background

View File

@ -7,9 +7,9 @@ bar_draw(struct Bar bar)
const int height = bar.fill * (float)bar.height;
const int y = bar.y + bar.height - height;
/* fill */
drect(bar.x, y, bar.x + BAR_WIDTH, y + height, C_GREEN);
/* borders */
drect_border(bar.x, bar.y, bar.x + BAR_WIDTH, bar.y + bar.height,
C_NONE, 2, C_BLACK);
drect_border(bar.x - 1, bar.y - 1, bar.x + BAR_WIDTH + 1, bar.y + bar.height + 1,
C_WHITE, 2, C_BLACK);
/* fill */
drect(bar.x, y, bar.x + BAR_WIDTH, y + height, C_RGB(0, 32, 32));
}

View File

@ -2,20 +2,39 @@
#include <gint/display.h>
#include <gint/keyboard.h>
static struct Bar bars[4];
static void main_draw(void);
int
main(void)
{
int i;
struct Bar bars[4];
/* init */
for (i = 0; i < 4; i += 1)
bars[i] = bar_init(i);
dclear(C_WHITE);
for (i = 0; i < 4; i += 1)
bar_draw(bars[i]);
dupdate();
main_draw();
getkey();
return 1;
}
static void
main_draw(void)
{
extern bopti_image_t bimg_background;
int i;
dclear(C_WHITE);
/* draw background */
dimage(0, 0, &bimg_background);
/* draw bars */
for (i = 0; i < 4; i += 1)
bar_draw(bars[i]);
dupdate();
}