TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
TurtleBrains::Express::Graphics::ShadowedText Class Reference

#include <tbx_shadowed_text.hpp>

Inheritance diagram for TurtleBrains::Express::Graphics::ShadowedText:
TurtleBrains::Graphics::Graphic

Public Member Functions

 ShadowedText (const tbCore::String &text=tb_string(""), const tbGraphics::FontSize pointSize=tbGraphics::Text::DefaultFontSize(), const tbCore::String &fontFilepath=tbGraphics::Text::DefaultFontFile(), const tbGraphics::Color &shadowColor=tbGraphics::Color(0xFF202020))
 
tbCore::String GetText (void) const
 
void SetText (const tbCore::String &text, const tbGraphics::FontSize pointSize, const tbCore::String &fontFilepath)
 
void SetText (const tbCore::String &text)
 
virtual void SetColor (const tbGraphics::Color &newColor) override
 
void SetColor (const tbGraphics::Color &topColor, const tbGraphics::Color &bottomColor)
 
tbGraphics::Color GetShadowColor (void) const
 
void SetShadowColor (const tbGraphics::Color &shadowColor)
 
tbGraphics::PixelSpace GetShadowOffset (void) const
 
void SetShadowOffset (const tbGraphics::PixelSpace &shadowOffset)
 
virtual tbGraphics::PixelSpace GetPixelWidth (void) const override
 
virtual tbGraphics::PixelSpace GetPixelHeight (void) const override
 
- Public Member Functions inherited from TurtleBrains::Graphics::Graphic
 Graphic (void)
 
 Graphic (const Graphic &other)=default
 
virtual ~Graphic (void)=default
 
Graphicoperator= (const Graphic &other)=default
 
bool IsActive (void) const
 
void SetActive (const bool isActive)
 
void Update (const float deltaTime)
 
bool IsVisible (void) const
 
void SetVisible (const bool isVisible)
 
void Render (void) const
 
const tbMath::Vector2GetPosition (void) const
 
void SetPosition (const float x, const float y)
 
void SetPosition (const tbMath::Vector2 &position)
 
const tbMath::Vector2GetOrigin (void) const
 
void SetOrigin (const AnchorLocation &anchor, const float offsetX, const float offsetY)
 
void SetOrigin (const AnchorLocation &anchor, const tbMath::Vector2 &offset=tbMath::Vector2::Zero())
 
void SetOrigin (const float originX, const float originY)
 
void SetOrigin (const tbMath::Vector2 &origin)
 
float GetDepth (void) const
 
void SetDepth (const float newDepth)
 
const tbMath::Vector2GetScale (void) const
 
void SetScale (const float scale)
 
void SetScale (const tbMath::Vector2 &scale)
 
void SetScale (const float scaleX, const float scaleY)
 
tbMath::Angle GetRotation (void) const
 
void SetRotation (const tbMath::Angle &angle)
 
void SetScroll (const float scroll)
 
void SetScroll (const float scrollX, const float scrollY)
 
bool IsRelative (void) const
 
const ColorGetColor (void) const
 
float GetWidth (void) const
 
float GetHeight (void) const
 
float GetScaledWidth (void) const
 
float GetScaledHeight (void) const
 
tbMath::Vector2 GetAnchorPosition (const tbGraphics::AnchorLocation &anchor, const float offsetX, const float offsetY) const
 
tbMath::Vector2 GetAnchorPosition (const tbGraphics::AnchorLocation &anchor, const tbMath::Vector2 &offset=tbMath::Vector2::Zero()) const
 
bool UnstableIsPointContained (const tbMath::Vector2 &point) const
 

Protected Member Functions

virtual void OnRender (void) const override
 
- Protected Member Functions inherited from TurtleBrains::Graphics::Graphic
virtual void OnUpdate (const float deltaTime)
 
virtual void ApplyTransform (void) const
 
virtual void PopTransform (void) const
 

Detailed Description

The ShadowedText object essentially renders the text object several times to create a stroke/shadow effect behind the text with a different color than the original text.

Note
As of 2025-03-19 in TurtleBrains v0.4.3 one should use the regular Text object and SetOutlineThickness(), SetOutlineColor() etc for the capabilities this use to provide. Consider ShadowedText deprecated as it will be removed. Someday. In the future. Maybe 2028?

Member Function Documentation

◆ GetPixelHeight()

virtual tbGraphics::PixelSpace TurtleBrains::Express::Graphics::ShadowedText::GetPixelHeight ( void  ) const
inlineoverridevirtual

This should be overridden to return the height of the graphic in PixelSpace units to be used in placement and anchor point computations.

Reimplemented from TurtleBrains::Graphics::Graphic.

◆ GetPixelWidth()

virtual tbGraphics::PixelSpace TurtleBrains::Express::Graphics::ShadowedText::GetPixelWidth ( void  ) const
inlineoverridevirtual

This should be overridden to return the width of the graphic in PixelSpace units to be used in placement and anchor point computations.

Reimplemented from TurtleBrains::Graphics::Graphic.

◆ OnRender()

virtual void TurtleBrains::Express::Graphics::ShadowedText::OnRender ( void  ) const
overrideprotectedvirtual

This must be overridden by a subclass to actually display the Graphic on the screen. The function will be invoked when Render() is called and the object IsVisible().

Note
OnRender() should not be called directly, even from a subclass. Use Render() which will first check if the Graphic IsVisible() before displaying with OnRender().

Implements TurtleBrains::Graphics::Graphic.

◆ SetColor()

virtual void TurtleBrains::Express::Graphics::ShadowedText::SetColor ( const tbGraphics::Color newColor)
overridevirtual

Change the color of the sprite so it can fade in/out with alpha, or modify the color for other effects.

Reimplemented from TurtleBrains::Graphics::Graphic.