Blamite Game Engine - Blam (Core)
BlamRendering::RenderStack::DWText Class Reference

Class containing data for a text object using DirectWrite. More...

#include <render_stack.h>

+ Inheritance diagram for BlamRendering::RenderStack::DWText:

Public Member Functions

 DWText ()
 Sets the stack type and default zone color. More...
 
 ~DWText ()
 Empty destructor. More...
 
void Draw ()
 Draws the stack object. More...
 
void ShowImPropertyEditor ()
 Shows a set of ImGUI properties associated with the object. More...
 
void SetText (std::string new_text)
 Sets the text to display. More...
 
void SetFont (std::string new_font_name)
 Sets the font to use for the text. More...
 
void ShowZoneEdge (bool show)
 Enables or disables the display of the text area bounds. More...
 
void SetZoneColor (float new_color[3])
 Sets the color to use for the zone edge. More...
 
void SetZoneColor (float r, float g, float b)
 Sets the color to use for the zone edge. More...
 
void SetZoneColor (float r, float g, float b, float a)
 Sets the color to use for the zone edge. More...
 
void SetZoneColor (D2D1::ColorF color)
 Sets the color to use for the zone edge. More...
 
void SetFontSize (float new_size)
 Sets the size to use for the font. More...
 
void SetZoneThickness (float new_thickness)
 Sets the thickness of the zone edge. 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::wstring text = L"generic text"
 The current text to display. More...
 
std::wstring font_name = L"Comic Sans MS"
 The current font name. Defaults to Comic Sans MS. :lmao: More...
 
float font_size = 12
 The size of the text. 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_engine_font = false
 Whether to use a font within the engine or a system font. More...
 
std::string engine_font_id = ""
 The ID of the font collection to use. More...
 
IDWriteFontCollection * font_collection
 The thickness of the zone border. 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 area for the text. 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 containing data for a text object using DirectWrite.

Constructor & Destructor Documentation

◆ DWText()

BlamRendering::RenderStack::DWText::DWText ( )
inline

Sets the stack type and default zone color.

◆ ~DWText()

BlamRendering::RenderStack::DWText::~DWText ( )
inline

Empty destructor.

Member Function Documentation

◆ Draw()

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

Draws the stack object.

Specific functionality may vary depending on the type of object.

Reimplemented from BlamRendering::RenderStack::StackObjectBase.

◆ SetFont()

void BlamRendering::RenderStack::DWText::SetFont ( std::string  new_font_name)

Sets the font to use for the text.

Parameters
new_font_name- The name of the font to use.

◆ SetFontSize()

void BlamRendering::RenderStack::DWText::SetFontSize ( float  new_size)

Sets the size to use for the font.

Parameters
new_size- The new size of the font.

◆ SetText()

void BlamRendering::RenderStack::DWText::SetText ( std::string  new_text)

Sets the text to display.

Parameters
new_text- The new text to display.

◆ SetZoneColor() [1/4]

void BlamRendering::RenderStack::DWText::SetZoneColor ( D2D1::ColorF  color)

Sets the color to use for the zone edge.

Parameters
color- The new color of the zone edge.

◆ SetZoneColor() [2/4]

void BlamRendering::RenderStack::DWText::SetZoneColor ( float  new_color[3])

Sets the color to use for the zone edge.

Parameters
new_color- The new color of the zone edge. Items must be in the following order:

red, green, blue

◆ SetZoneColor() [3/4]

void BlamRendering::RenderStack::DWText::SetZoneColor ( float  r,
float  g,
float  b 
)

Sets the color to use for the zone edge.

Parameters
r- The Red value of the color.
g- The Green value of the color.
b- The Blue value of the color.

◆ SetZoneColor() [4/4]

void BlamRendering::RenderStack::DWText::SetZoneColor ( float  r,
float  g,
float  b,
float  a 
)

Sets the color to use for the zone edge.

Parameters
r- The Red value of the color.
g- The Green value of the color.
b- The Blue value of the color.
a- The Alpha value of the color.

◆ SetZoneThickness()

void BlamRendering::RenderStack::DWText::SetZoneThickness ( float  new_thickness)

Sets the thickness of the zone edge.

Parameters
new_thickness- The new thickness of the zone edge.

◆ ShowImPropertyEditor()

void BlamRendering::RenderStack::DWText::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.

◆ ShowZoneEdge()

void BlamRendering::RenderStack::DWText::ShowZoneEdge ( bool  show)

Enables or disables the display of the text area bounds.

Parameters
show- Whether or not to display the zone edge.

Member Data Documentation

◆ auto_calculate_area

bool BlamRendering::RenderStack::DWText::auto_calculate_area = false

Whether or not to automatically calculate the area for the text.

◆ engine_font_id

std::string BlamRendering::RenderStack::DWText::engine_font_id = ""

The ID of the font collection to use.

◆ font_buffer

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

Font name buffer for ImGUI editor.

◆ font_collection

IDWriteFontCollection* BlamRendering::RenderStack::DWText::font_collection

The thickness of the zone border.

◆ font_name

std::wstring BlamRendering::RenderStack::DWText::font_name = L"Comic Sans MS"

The current font name. Defaults to Comic Sans MS. :lmao:

◆ font_size

float BlamRendering::RenderStack::DWText::font_size = 12

The size of the text.

◆ show_zone

bool BlamRendering::RenderStack::DWText::show_zone = false

Whether or not to show the text zone.

◆ text

std::wstring BlamRendering::RenderStack::DWText::text = L"generic text"

The current text to display.

◆ text_buffer

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

Text buffer for ImGUI editor.

◆ use_engine_font

bool BlamRendering::RenderStack::DWText::use_engine_font = false

Whether to use a font within the engine or a system font.

◆ zone_color

D2D1_COLOR_F BlamRendering::RenderStack::DWText::zone_color

The color to use for the zone border.

◆ zone_thickness

float BlamRendering::RenderStack::DWText::zone_thickness = 1

The thickness of the zone border.


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