pcadmin/include/bar.h

36 lines
827 B
C
Raw Normal View History

2021-04-16 11:08:47 +02:00
#pragma once
#include <gint/display.h>
extern bopti_image_t bimg_bar3;
2021-05-26 00:29:23 +02:00
extern bopti_image_t bimg_icons;
2021-05-26 00:29:23 +02:00
#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)
2021-04-16 11:08:47 +02:00
struct Bar {
2021-05-26 00:29:23 +02:00
int id;
2021-04-16 11:08:47 +02:00
int x;
int y;
int height;
int limit_height;
2021-04-16 11:08:47 +02:00
float fill;
};
2021-05-24 12:11:04 +02:00
#define BAR_TOTAL 4
2021-05-24 11:07:56 +02:00
enum BarID { BAR_CASH, BAR_HUMAN, BAR_SMILE, BAR_SUN };
struct Bar bar_init(enum BarID bar_id);
void bar_deinit(void);
2021-04-16 11:08:47 +02:00
void bar_update(struct Bar *bar);
void bar_draw(struct Bar bar);
2021-05-24 12:11:04 +02:00
/* Increase/decrease bar fill level.
* Return 1 when bar is fully filled.
* Return -1 when bar is fully emptied.
* Return 0 otherwise. */
int bar_change(struct Bar *bar, float modifier);