From e5dc1105b4ef4762c2cad63f9741a1e214a1a389 Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Thu, 14 Apr 2016 01:21:25 +0100 Subject: [PATCH] Improve HUD with rounding and CRUISE CONTROL FOR COOL. --- rwgame/DrawUI.cpp | 4 ++-- rwgame/MenuSystem.hpp | 6 +++++- rwgame/debugstate.cpp | 10 ++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/rwgame/DrawUI.cpp b/rwgame/DrawUI.cpp index 73b89117..4958f02b 100644 --- a/rwgame/DrawUI.cpp +++ b/rwgame/DrawUI.cpp @@ -99,7 +99,7 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world, GameRenderer* re { std::stringstream ss; ss << "@" << std::setw(3) << std::setfill('0') - << player->getCharacter()->getCurrentState().health; + << (int)player->getCharacter()->getCurrentState().health; ti.text = ss.str(); } ti.baseColour = glm::vec3(0.f, 0.f, 0.f); @@ -114,7 +114,7 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world, GameRenderer* re { std::stringstream ss; ss << "[" << std::setw(3) << std::setfill('0') - << player->getCharacter()->getCurrentState().armour; + << (int)player->getCharacter()->getCurrentState().armour; ti.text = ss.str(); ti.baseColour = glm::vec3(0.f, 0.f, 0.f); ti.screenPosition = glm::vec2(infoTextX + 1.f - ui_armourOffset, infoTextY+1.f); diff --git a/rwgame/MenuSystem.hpp b/rwgame/MenuSystem.hpp index bfaad88d..6a9b257c 100644 --- a/rwgame/MenuSystem.hpp +++ b/rwgame/MenuSystem.hpp @@ -5,6 +5,7 @@ #include #include #include +#include class Menu { @@ -19,7 +20,10 @@ public: std::string name; float _size; - MenuEntry(const std::string& n, float size = 30.f) : name(n), _size(size) {} + MenuEntry(const std::string& n, float size = 30.f) : name(n), _size(size) + { + std::transform(name.begin(), name.end(), name.begin(), toupper); + } float getHeight() { return _size; } diff --git a/rwgame/debugstate.cpp b/rwgame/debugstate.cpp index 77dfabc0..5b140372 100644 --- a/rwgame/debugstate.cpp +++ b/rwgame/debugstate.cpp @@ -27,8 +27,8 @@ DebugState::DebugState(RWGame* game, const glm::vec3& vp, const glm::quat& vd) : State(game), _freeLook( false ), _sonicMode( false ) { Menu *m = new Menu(2); - m->offset = glm::vec2(200.f, 200.f); - float entryHeight = 24.f; + m->offset = glm::vec2(10.f, 50.f); + float entryHeight = 14.f; #if 0 m->addEntry(Menu::lambda("Random Vehicle", [this] { auto it = getWorld()->vehicleTypes.begin(); @@ -106,6 +106,12 @@ DebugState::DebugState(RWGame* game, const glm::vec3& vp, const glm::quat& vd) m->addEntry(Menu::lambda("Set Normal Jump", [=] { game->getPlayer()->getCharacter()->setJumpSpeed(CharacterObject::DefaultJumpSpeed); }, entryHeight)); + m->addEntry(Menu::lambda("Full Health", [=] { + game->getPlayer()->getCharacter()->getCurrentState().health = 100.f; + }, entryHeight)); + m->addEntry(Menu::lambda("Full Armour", [=] { + game->getPlayer()->getCharacter()->getCurrentState().armour = 100.f; + }, entryHeight)); this->enterMenu(m);