1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

Improve HUD with rounding and CRUISE CONTROL FOR COOL.

This commit is contained in:
Daniel Evans 2016-04-14 01:21:25 +01:00
parent 07f7b19ca2
commit e5dc1105b4
3 changed files with 15 additions and 5 deletions

View File

@ -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);

View File

@ -5,6 +5,7 @@
#include <glm/glm.hpp>
#include <render/GameRenderer.hpp>
#include <functional>
#include <algorithm>
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; }

View File

@ -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);