From 20b29fccb6da62d5a07a02477fabac3a80d350dd Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 13 Nov 2015 17:46:08 -0500 Subject: ui fixes --- src/ui.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/ui.cpp b/src/ui.cpp index 6fff65f..bbec2de 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -458,22 +458,33 @@ namespace ui { setFontColor(255,255,255); } - putText(((SCREEN_WIDTH/2)+offset.x)-125,(offset.y+SCREEN_HEIGHT/2)-fontSize,"Health: %u/%u",player->health>0?(unsigned)player->health:0, - (unsigned)player->maxHealth); + vec2 hub = { + (SCREEN_WIDTH/2+offset.x)-fontSize*10, + (offset.y+SCREEN_HEIGHT/2)-fontSize + }; + + putText(hub.x,hub.y,"Health: %u/%u",player->health>0?(unsigned)player->health:0, + (unsigned)player->maxHealth); if(player->alive){ glColor3ub(255,0,0); - glRectf((SCREEN_WIDTH/2+offset.x)-125, - (offset.y+SCREEN_HEIGHT/2)-32, - ((SCREEN_WIDTH/2+offset.x)-125)+((player->health/player->maxHealth)*100), - (offset.y+SCREEN_HEIGHT/2)-32+12); + hub.y-=fontSize*1.15; + glRectf(hub.x, + hub.y, + hub.x+(player->health/player->maxHealth)*100, + hub.y+12); } + /* * Lists all of the quests the player has */ - putText(((SCREEN_WIDTH/2)+offset.x)-125,(offset.y+SCREEN_HEIGHT/2)-fontSize*4, "Current Quests:",NULL); + + hub.y-=fontSize*1.15; + + putString(hub.x,hub.y,"Current Quests:"); for(auto &c : player->qh.current){ - putText(((SCREEN_WIDTH/2)+offset.x)-125,(offset.y+SCREEN_HEIGHT/2)-fontSize*5, "%s",c->title); + hub.y-=fontSize*1.15; + putString(hub.x,hub.y,c->title); } } void handleEvents(void){ -- cgit v1.2.3