Ugly background image
This commit is contained in:
parent
de8a218bcc
commit
1f0dc26baa
|
@ -18,7 +18,9 @@ set(SOURCES
|
|||
src/bar/draw.c
|
||||
)
|
||||
|
||||
set(ASSETS)
|
||||
set(ASSETS
|
||||
assets/background.png
|
||||
)
|
||||
|
||||
set(FLAGS
|
||||
-std=c11
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 128 KiB |
|
@ -0,0 +1,4 @@
|
|||
# gint bopti_image_t
|
||||
background.png:
|
||||
type: bopti-image
|
||||
name: bimg_background
|
|
@ -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));
|
||||
}
|
||||
|
|
29
src/main.c
29
src/main.c
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue