diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-06-10 21:35:12 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-06-10 21:35:12 +0200 |
commit | 36418bdd6e01504c745770913811fcb174e4df5f (patch) | |
tree | 5347d706a6faaf413294189f908079af0603166c | |
parent | 2308ed66087a16b542e9c1a24ea91d8502af463b (diff) | |
download | dungeon_game-36418bdd6e01504c745770913811fcb174e4df5f.tar.xz |
Center healthbar
-rw-r--r-- | plugins/game/game.c | 2 | ||||
-rw-r--r-- | 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); |