improve HUD
This commit is contained in:
parent
ce0959f3f6
commit
53d4281eb8
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 315 B |
Binary file not shown.
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 588 B |
21
src/render.c
21
src/render.c
|
@ -307,6 +307,9 @@ void render_game(game_t const *g, bool show_hitboxes)
|
|||
|
||||
/* Render skill icons */
|
||||
extern bopti_image_t img_skillicons;
|
||||
static const int skill_size = 23;
|
||||
static const int skill_box_size = 27;
|
||||
|
||||
for(int i = 0; i < 6; i++) {
|
||||
/* Activity and cooldown */
|
||||
fixed_t cooldown_total=0, cooldown_remaining=0;
|
||||
|
@ -319,17 +322,21 @@ void render_game(game_t const *g, bool show_hitboxes)
|
|||
cooldown_remaining = player_f->actions_cooldown[i-1];
|
||||
}
|
||||
|
||||
int x = 33 + 44*i + 84*(i>=3);
|
||||
int y = DHEIGHT - 29;
|
||||
int x = 31 + 48*i + 64*(i>=3);
|
||||
int y = DHEIGHT - 33;
|
||||
int bg = (cooldown_remaining != 0);
|
||||
dsubimage(x+2, y+2, &img_skillicons, 19*bg, 0, 19, 19, DIMAGE_NONE);
|
||||
dsubimage(x+2, y+2, &img_skillicons, 19*(i+2), 0, 19, 19, DIMAGE_NONE);
|
||||
dsubimage(x+2, y+2, &img_skillicons, skill_size * bg, 0, skill_size,
|
||||
skill_size, DIMAGE_NONE);
|
||||
dsubimage(x+2, y+2, &img_skillicons, skill_size * (i+2), 0, skill_size,
|
||||
skill_size, DIMAGE_NONE);
|
||||
|
||||
/* Darken the area representing remaining cooldown */
|
||||
if(cooldown_total != 0) {
|
||||
int height = (cooldown_remaining * 23) / cooldown_total;
|
||||
for(int y1 = y+23-height; y1 < y + 23; y1++) {
|
||||
for(int x1 = x; x1 < x+23; x1++) {
|
||||
int height = (cooldown_remaining*skill_box_size) / cooldown_total;
|
||||
int ymin = y + skill_box_size - height;
|
||||
int ymax = y + skill_box_size;
|
||||
for(int y1 = ymin; y1 < ymax; y1++) {
|
||||
for(int x1 = x; x1 < x + skill_box_size; x1++) {
|
||||
int i = DWIDTH * y1 + x1;
|
||||
gint_vram[i] = ~((~gint_vram[i] & 0xf7de) >> 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue