diff --git a/include/Game/Systems/TextFieldReader.h b/include/Game/Systems/TextFieldReader.h index 1ea8e966..290bedbc 100644 --- a/include/Game/Systems/TextFieldReader.h +++ b/include/Game/Systems/TextFieldReader.h @@ -2,6 +2,8 @@ #define AmmunitionHUDSystem_h__ #include +#include +#include #include "../../Engine/Core/System.h" #include "../../Engine/GLM.h" diff --git a/resources/Schema/Entities/ScoreIdentity.xml b/resources/Schema/Entities/ScoreIdentity.xml index b2df3821..2d1b471a 100644 --- a/resources/Schema/Entities/ScoreIdentity.xml +++ b/resources/Schema/Entities/ScoreIdentity.xml @@ -54,7 +54,7 @@ - 0 + 0.0 Fonts/DroidSans.ttf,64 @@ -66,7 +66,7 @@ KD - + diff --git a/src/Game/Systems/TextFieldReader.cpp b/src/Game/Systems/TextFieldReader.cpp index 8712a61f..c2e5c1e4 100644 --- a/src/Game/Systems/TextFieldReader.cpp +++ b/src/Game/Systems/TextFieldReader.cpp @@ -35,9 +35,17 @@ void TextFieldReader::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c if (field.Type == "int") { text = boost::lexical_cast((const int&)component[fieldName]); } else if (field.Type == "float") { - text = boost::lexical_cast((const float&)component[fieldName]); + std::ostringstream ss; + float f = (float)component[fieldName]; + ss << std::fixed << std::setprecision(2); + ss << f; + text = ss.str(); } else if (field.Type == "double") { - text = boost::lexical_cast((const double&)component[fieldName]); + std::ostringstream ss; + double d = (double)component[fieldName]; + ss << std::fixed << std::setprecision(1); + ss << d; + text = ss.str(); } else if (field.Type == "bool") { text = boost::lexical_cast((const bool&)component[fieldName]); } else if (field.Type == "string") {