2 #include "../game/game.h"
4 static struct color red = {255, 0, 0};
5 static struct color gray;
7 static void render_healthbar(struct winsize ws)
9 int y = max(ws.ws_row - 2, 0);
10 int x = max(ws.ws_col / 2 - player.max_health, 0);
12 printf("\e[%u;%uH", y, x);
14 set_color(red, false);
16 int health = max(player.health, 0);
18 for (int i = 0; i < player.max_health; i++) {
20 set_color(gray, false);
25 __attribute__ ((constructor)) static void init()
27 gray = get_color("#5A5A5A");
29 register_render_component(&render_healthbar);