double's should now be displayed with only 1 decimal.
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
#define AmmunitionHUDSystem_h__
|
#define AmmunitionHUDSystem_h__
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
#include "../../Engine/Core/System.h"
|
#include "../../Engine/Core/System.h"
|
||||||
#include "../../Engine/GLM.h"
|
#include "../../Engine/GLM.h"
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
<Entity name="KD">
|
<Entity name="KD">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
<Content>0</Content>
|
<Content>0.0</Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Alignment>
|
<Alignment>
|
||||||
<Left/>
|
<Left/>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<Field>KD</Field>
|
<Field>KD</Field>
|
||||||
</c:TextFieldReader>
|
</c:TextFieldReader>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="2" Y="0" Z="0"/>
|
<Position X="1.28572214" Y="0" Z="0"/>
|
||||||
<Scale X="2" Y="2" Z="2"/>
|
<Scale X="2" Y="2" Z="2"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
|
|||||||
@@ -35,9 +35,17 @@ void TextFieldReader::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
|||||||
if (field.Type == "int") {
|
if (field.Type == "int") {
|
||||||
text = boost::lexical_cast<std::string>((const int&)component[fieldName]);
|
text = boost::lexical_cast<std::string>((const int&)component[fieldName]);
|
||||||
} else if (field.Type == "float") {
|
} else if (field.Type == "float") {
|
||||||
text = boost::lexical_cast<std::string>((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") {
|
} else if (field.Type == "double") {
|
||||||
text = boost::lexical_cast<std::string>((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") {
|
} else if (field.Type == "bool") {
|
||||||
text = boost::lexical_cast<std::string>((const bool&)component[fieldName]);
|
text = boost::lexical_cast<std::string>((const bool&)component[fieldName]);
|
||||||
} else if (field.Type == "string") {
|
} else if (field.Type == "string") {
|
||||||
|
|||||||
Reference in New Issue
Block a user