Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
BlamRendering::RenderStack::Text Class Reference

Class used to wrap around BitmapText and DWText, making the usage of both of them directly unnecessary. More...

#include <render_stack.h>

+ Inheritance diagram for BlamRendering::RenderStack::Text:

Public Member Functions

 Text ()
 Sets the stack type, creates the needed resources, and sets some default colors. More...
 
 ~Text ()
 Deletes any used resources. More...
 
void SetText (std::string text)
 Sets the text to display. More...
 
void UpdateAllProperties ()
 Applies any modified parent properties to the appropriate child object. More...
 
void SetFont (std::string new_font_id)
 Sets the font to use for the text. More...
 
std::string GetFont ()
 Retrieves the ID of the active font. More...
 
void RefreshTranslation ()
 Refreshes any translation data and applies them to the child objects. More...
 
void Draw ()
 Draws the stack object. More...
 
void ShowImPropertyEditor ()
 Shows a set of ImGUI properties associated with the object. More...
 
- Public Member Functions inherited from BlamRendering::RenderStack::StackObjectBase
 StackObjectBase ()
 Sets default values and provides a default ID to be used if none is provided. More...
 
 ~StackObjectBase ()
 Empty destructor. More...
 
virtual void HandleResize ()
 Called upon window resize events. More...
 
void SetArea (float new_area[4])
 Sets the area of the object. More...
 
void SetArea (float top, float bottom, float left, float right)
 Sets the area of the object. More...
 
void SetArea (D2D1_RECT_F new_area)
 Sets the area of the object. More...
 
void SetColor (float new_color[3])
 Sets the color of the object. More...
 
void SetColor (float r, float g, float b)
 Sets the color of the object. More...
 
void SetColor (float r, float g, float b, float a)
 Sets the color of the object. More...
 
void SetColor (D2D1::ColorF color)
 Sets the color of the object. More...
 
void SetZOrder (int z)
 Sets the Z-Order of the object. More...
 
void SetTranslation (float new_x, float new_y)
 Sets the translation of the object. More...
 
void PokeTranslation ()
 Updates the area of the object to account for any x/y coordinate changes. More...
 
void SetSize (float new_width, float new_height)
 Sets the size of the object. More...
 
void PokeSize ()
 Updates the area of the object to account for any width/height changes. More...
 
void ValidateSizeAndTranslation ()
 Validates X/Y coordinates and Width/Height sizes after the area has been modified. More...
 
std::string GetType ()
 Retrieves the type of item that this stack object is. More...
 
std::string GetDrawModeLabel ()
 Retrieves the current drawing mode of the object. More...
 

Public Attributes

std::string text = "the quick brown fox jumped over the lazy dog"
 The text to display. More...
 
float font_size = 12.0f
 The size of the font. Only used with TrueType fonts. More...
 
int shadow_x = 1
 The X offset of the drop shadow. More...
 
int shadow_y = 1
 The Y offset of the drop shadow. More...
 
D2D1_COLOR_F shadow_color
 The color to use for the drop shadow. More...
 
bool use_shadow = false
 Whether or not to draw the text with a drop shadow. More...
 
bool show_zone = false
 Whether or not to show the text zone. More...
 
D2D1_COLOR_F zone_color
 The color to use for the zone border. More...
 
float zone_thickness = 1
 The thickness of the zone border. More...
 
bool use_background = false
 Whether or not to draw a background behind the text. More...
 
D2D1_COLOR_F bg_color
 The color to use for the text background. More...
 
char text_buffer [1024] = ""
 Text buffer for ImGUI editor. More...
 
char font_buffer [256] = ""
 Font name buffer for ImGUI editor. More...
 
bool auto_calculate_area = false
 Whether or not to automatically calculate the text area. More...
 
- Public Attributes inherited from BlamRendering::RenderStack::StackObjectBase
D2D1_RECT_F area
 The area of the object. More...
 
D2D1_COLOR_F color
 The color of the object. More...
 
int z_order = 0
 The Z-Order of the object. More...
 
StackType type_label = STACKTYPE_GENERIC
 The type of the object. More...
 
StackItemDrawMode draw_mode = DEFAULT_DRAWMODE
 The drawing mode of the object. More...
 
bool visible = true
 Whether or not the object is visible. More...
 
float x = 0
 The X coordinate of the object. More...
 
float y = 0
 The Y coordinate of the object. More...
 
float width = 100
 The width of the object. More...
 
float height = 100
 The height of the object. More...
 
std::string unique_id = ""
 The unique ID of this object. More...
 

Detailed Description

Class used to wrap around BitmapText and DWText, making the usage of both of them directly unnecessary.

Constructor & Destructor Documentation

◆ Text()

BlamRendering::RenderStack::Text::Text ( )

Sets the stack type, creates the needed resources, and sets some default colors.

◆ ~Text()

BlamRendering::RenderStack::Text::~Text ( )

Deletes any used resources.

Member Function Documentation

◆ Draw()

void BlamRendering::RenderStack::Text::Draw ( )
virtual

Draws the stack object.

Specific functionality may vary depending on the type of object.

Reimplemented from BlamRendering::RenderStack::StackObjectBase.

◆ GetFont()

std::string BlamRendering::RenderStack::Text::GetFont ( )

Retrieves the ID of the active font.

Returns
The ID of this object's current font.

◆ RefreshTranslation()

void BlamRendering::RenderStack::Text::RefreshTranslation ( )

Refreshes any translation data and applies them to the child objects.

Should be called any time the X/Y coordinates are modified.

◆ SetFont()

void BlamRendering::RenderStack::Text::SetFont ( std::string  new_font_id)

Sets the font to use for the text.

Parameters
new_font_id- The ID of the font to use.

◆ SetText()

void BlamRendering::RenderStack::Text::SetText ( std::string  text)

Sets the text to display.

Parameters
new_text- The new text to display.

◆ ShowImPropertyEditor()

void BlamRendering::RenderStack::Text::ShowImPropertyEditor ( )
virtual

Shows a set of ImGUI properties associated with the object.

This will call functions to draw only the property controls for the item, and nothing else. The window/container for the properties must be handled externally.

Reimplemented from BlamRendering::RenderStack::StackObjectBase.

◆ UpdateAllProperties()

void BlamRendering::RenderStack::Text::UpdateAllProperties ( )

Applies any modified parent properties to the appropriate child object.

Should be called any time any of the properties are directly modified.

Member Data Documentation

◆ auto_calculate_area

bool BlamRendering::RenderStack::Text::auto_calculate_area = false

Whether or not to automatically calculate the text area.

◆ bg_color

D2D1_COLOR_F BlamRendering::RenderStack::Text::bg_color

The color to use for the text background.

◆ font_buffer

char BlamRendering::RenderStack::Text::font_buffer[256] = ""

Font name buffer for ImGUI editor.

◆ font_size

float BlamRendering::RenderStack::Text::font_size = 12.0f

The size of the font. Only used with TrueType fonts.

◆ shadow_color

D2D1_COLOR_F BlamRendering::RenderStack::Text::shadow_color

The color to use for the drop shadow.

◆ shadow_x

int BlamRendering::RenderStack::Text::shadow_x = 1

The X offset of the drop shadow.

◆ shadow_y

int BlamRendering::RenderStack::Text::shadow_y = 1

The Y offset of the drop shadow.

◆ show_zone

bool BlamRendering::RenderStack::Text::show_zone = false

Whether or not to show the text zone.

◆ text

std::string BlamRendering::RenderStack::Text::text = "the quick brown fox jumped over the lazy dog"

The text to display.

◆ text_buffer

char BlamRendering::RenderStack::Text::text_buffer[1024] = ""

Text buffer for ImGUI editor.

◆ use_background

bool BlamRendering::RenderStack::Text::use_background = false

Whether or not to draw a background behind the text.

◆ use_shadow

bool BlamRendering::RenderStack::Text::use_shadow = false

Whether or not to draw the text with a drop shadow.

◆ zone_color

D2D1_COLOR_F BlamRendering::RenderStack::Text::zone_color

The color to use for the zone border.

◆ zone_thickness

float BlamRendering::RenderStack::Text::zone_thickness = 1

The thickness of the zone border.


The documentation for this class was generated from the following files: