From 36418bdd6e01504c745770913811fcb174e4df5f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 10 Jun 2021 21:35:12 +0200 Subject: [PATCH] Center healthbar --- plugins/game/game.c | 2 +- plugins/healthbar/healthbar.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/game/game.c b/plugins/game/game.c index bd93419..ea6a665 100644 --- a/plugins/game/game.c +++ b/plugins/game/game.c @@ -369,7 +369,7 @@ static void render_map(struct winsize ws) printf(" "); } - for (int i = 0; i < rows_left + 1; i++) + for (int i = 0; i < rows_left; i++) for (int i = 0; i < ws.ws_col; i++) printf(" "); } diff --git a/plugins/healthbar/healthbar.c b/plugins/healthbar/healthbar.c index 5651051..c66d3f1 100644 --- a/plugins/healthbar/healthbar.c +++ b/plugins/healthbar/healthbar.c @@ -7,7 +7,7 @@ static struct color gray; static void render_healthbar(struct winsize ws) { int y = max(ws.ws_row - 2, 0); - int x = max(ws.ws_col / 2 - player.max_health, 0); + int x = max(ws.ws_col / 2 - player.max_health / 2, 0); printf("\e[%u;%uH", y, x); -- 2.44.0