Add text outlines!

This commit is contained in:
Lynix
2019-04-16 01:46:26 +02:00
parent 8a8c233840
commit 79b0bd644c
12 changed files with 332 additions and 166 deletions

View File

@@ -38,12 +38,16 @@ namespace Nz
std::size_t GetGlyphCount() const override;
const Line& GetLine(std::size_t index) const override;
std::size_t GetLineCount() const override;
const Color& GetOutlineColor() const;
float GetOutlineThickness() const;
TextStyleFlags GetStyle() const;
const String& GetText() const;
void SetCharacterSize(unsigned int characterSize);
void SetColor(const Color& color);
void SetFont(Font* font);
void SetOutlineColor(const Color& color);
void SetOutlineThickness(float thickness);
void SetStyle(TextStyleFlags style);
void SetText(const String& str);
@@ -51,7 +55,9 @@ namespace Nz
SimpleTextDrawer& operator=(SimpleTextDrawer&& drawer);
static SimpleTextDrawer Draw(const String& str, unsigned int characterSize, TextStyleFlags style = TextStyle_Regular, const Color& color = Color::White);
static SimpleTextDrawer Draw(const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor);
static SimpleTextDrawer Draw(Font* font, const String& str, unsigned int characterSize, TextStyleFlags style = TextStyle_Regular, const Color& color = Color::White);
static SimpleTextDrawer Draw(Font* font, const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor);
private:
void ClearGlyphs() const;
@@ -72,6 +78,7 @@ namespace Nz
mutable std::vector<Glyph> m_glyphs;
mutable std::vector<Line> m_lines;
Color m_color;
Color m_outlineColor;
FontRef m_font;
mutable Rectf m_workingBounds;
mutable Recti m_bounds;
@@ -81,6 +88,7 @@ namespace Nz
mutable Vector2ui m_drawPos;
mutable bool m_colorUpdated;
mutable bool m_glyphUpdated;
float m_outlineThickness;
unsigned int m_characterSize;
};
}