Browse Source

Text effect settings accessible through Text3D and minor variable name consistancy change in Text.h

Bengt Soderstrom 9 years ago
parent
commit
19b69aad7e
3 changed files with 46 additions and 1 deletions
  1. 1 1
      Source/Urho3D/UI/Text.h
  2. 33 0
      Source/Urho3D/UI/Text3D.cpp
  3. 12 0
      Source/Urho3D/UI/Text3D.h

+ 1 - 1
Source/Urho3D/UI/Text.h

@@ -122,7 +122,7 @@ public:
     /// Set stroke thickness.
     void SetEffectStrokeThickness(int thickness);
     /// Set stroke rounding. Corners of the font will be rounded off in the stroke so the stroke won't have corners.
-    void SetEffectRoundStroke(bool roundCorners);
+    void SetEffectRoundStroke(bool roundStroke);
     /// Set effect color.
     void SetEffectColor(const Color& effectColor);
 

+ 33 - 0
Source/Urho3D/UI/Text3D.cpp

@@ -93,6 +93,9 @@ void Text3D::RegisterObject(Context* context)
     URHO3D_ATTRIBUTE("Bottom Left Color", Color, text_.color_[2], Color::WHITE, AM_DEFAULT);
     URHO3D_ATTRIBUTE("Bottom Right Color", Color, text_.color_[3], Color::WHITE, AM_DEFAULT);
     URHO3D_ENUM_ATTRIBUTE("Text Effect", text_.textEffect_, textEffects, TE_NONE, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Shadow Offset", IntVector2, text_.shadowOffset_, IntVector2(1, 1), AM_FILE);
+    URHO3D_ATTRIBUTE("Stroke Thickness", int, text_.strokeThickness_, 1, AM_FILE);
+    URHO3D_ATTRIBUTE("Round Stroke", bool, text_.roundStroke_, false, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Effect Color", GetEffectColor, SetEffectColor, Color, Color::BLACK, AM_DEFAULT);
     URHO3D_ATTRIBUTE("Effect Depth Bias", float, text_.effectDepthBias_, DEFAULT_EFFECT_DEPTH_BIAS, AM_DEFAULT);
     URHO3D_COPY_BASE_ATTRIBUTES(Drawable);
@@ -264,6 +267,21 @@ void Text3D::SetTextEffect(TextEffect textEffect)
     UpdateTextMaterials(true);
 }
 
+void Text3D::SetEffectShadowOffset(IntVector2 offset)
+{
+    text_.SetEffectShadowOffset(offset);
+}
+
+void Text3D::SetEffectStrokeThickness(int thickness)
+{
+    text_.SetEffectStrokeThickness(thickness);
+}
+
+void Text3D::SetEffectRoundStroke(bool roundStroke)
+{
+    text_.SetEffectRoundStroke(roundStroke);
+}
+
 void Text3D::SetEffectColor(const Color& effectColor)
 {
     text_.SetEffectColor(effectColor);
@@ -386,6 +404,21 @@ TextEffect Text3D::GetTextEffect() const
     return text_.GetTextEffect();
 }
 
+IntVector2 Text3D::GetEffectShadowOffset() const
+{
+    return text_.GetEffectShadowOffset();
+}
+
+int Text3D::GetEffectStrokeThickness() const
+{
+    return text_.GetEffectStrokeThickness();
+}
+
+bool Text3D::GetEffectRoundStroke() const
+{
+    return text_.GetEffectRoundStroke();
+}
+
 const Color& Text3D::GetEffectColor() const
 {
     return text_.GetEffectColor();

+ 12 - 0
Source/Urho3D/UI/Text3D.h

@@ -76,6 +76,12 @@ public:
     void SetWordwrap(bool enable);
     /// Set text effect.
     void SetTextEffect(TextEffect textEffect);
+    /// Set shadow offset.
+    void SetEffectShadowOffset(IntVector2 offset);
+    /// Set stroke thickness.
+    void SetEffectStrokeThickness(int thickness);
+    /// Set stroke rounding. Corners of the font will be rounded off in the stroke so the stroke won't have corners.
+    void SetEffectRoundStroke(bool roundStroke);
     /// Set effect color.
     void SetEffectColor(const Color& effectColor);
     /// Set effect Z bias.
@@ -111,6 +117,12 @@ public:
     bool GetWordwrap() const;
     /// Return text effect.
     TextEffect GetTextEffect() const;
+    /// Return effect shadow offset.
+    IntVector2 GetEffectShadowOffset() const;
+    /// Return effect stroke thickness.
+    int GetEffectStrokeThickness() const;
+    /// Return effect round stroke.
+    bool GetEffectRoundStroke() const;
     /// Return effect color.
     const Color& GetEffectColor() const;
     /// Return effect depth bias.