diff options
Diffstat (limited to 'src/graphics')
-rw-r--r-- | src/graphics/engine/text.cpp | 5 | ||||
-rw-r--r-- | src/graphics/engine/text.h | 8 | ||||
-rw-r--r-- | src/graphics/opengl/gldevice.cpp | 4 | ||||
-rw-r--r-- | src/graphics/opengl/gldevice.h | 2 |
4 files changed, 12 insertions, 7 deletions
diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 6355aed..66c73a9 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -407,10 +407,10 @@ int CText::Justify(const std::string &text, FontType font, float size, float wid if (len >= 3) ch.c3 = text[index+2]; - index += len; - if (ch.c1 == '\n') + { return index+1; + } if (ch.c1 == ' ' ) cut = index+1; @@ -421,6 +421,7 @@ int CText::Justify(const std::string &text, FontType font, float size, float wid if (cut == 0) return index; else return cut; } + index += len; } return index; diff --git a/src/graphics/engine/text.h b/src/graphics/engine/text.h index 4575c37..57fad43 100644 --- a/src/graphics/engine/text.h +++ b/src/graphics/engine/text.h @@ -227,7 +227,7 @@ class CText { public: CText(CInstanceManager *iMan, CEngine* engine); - ~CText(); + virtual ~CText(); //! Sets the device to be used void SetDevice(CDevice *device); @@ -269,12 +269,12 @@ public: float GetHeight(FontType font, float size); //! Returns width of string (multi-format) - float GetStringWidth(const std::string &text, + TEST_VIRTUAL float GetStringWidth(const std::string &text, std::map<unsigned int, FontMetaChar> &format, float size); //! Returns width of string (single font) - float GetStringWidth(const std::string &text, FontType font, float size); + TEST_VIRTUAL float GetStringWidth(const std::string &text, FontType font, float size); //! Returns width of single character - float GetCharWidth(UTF8Char ch, FontType font, float size, float offset); + TEST_VIRTUAL float GetCharWidth(UTF8Char ch, FontType font, float size, float offset); //! Justifies a line of text (multi-format) int Justify(const std::string &text, std::map<unsigned int, FontMetaChar> &format, diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index dbf91c7..ee77420 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -48,6 +48,10 @@ // Graphics module namespace namespace Gfx { +GLDeviceConfig::GLDeviceConfig() +{ + LoadDefault(); +} void GLDeviceConfig::LoadDefault() { diff --git a/src/graphics/opengl/gldevice.h b/src/graphics/opengl/gldevice.h index cda7b02..87c1247 100644 --- a/src/graphics/opengl/gldevice.h +++ b/src/graphics/opengl/gldevice.h @@ -52,7 +52,7 @@ struct GLDeviceConfig : public DeviceConfig bool hardwareAccel; //! Constructor calls LoadDefaults() - GLDeviceConfig() { LoadDefault(); } + GLDeviceConfig(); //! Loads the default values void LoadDefault(); |