Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::TextItem Class Reference

#include <StkTextItem.h>

Public Member Functions

 TextItem (std::shared_ptr< STK::Font > font, const std::string &text, TextHAlignment h_anchor, TextVAlignment v_anchor, float glyph_spacing)
 Create a text item. The text will be split on newline characters and organized in lines. These lines will be left justified regardless of the anchor point settings. The anchor point indicates where the origin of the text item is, and all transformations on the object will be relative to this point.
 
 TextItem (const std::shared_ptr< VertexBuffer2D > &vtx_buffer, std::shared_ptr< STK::Font > font, const std::string &text, TextHAlignment h_anchor, TextVAlignment v_anchor, float glyph_spacing)
 Create a text item. The text will be split on newline characters and organized in lines. These lines will be left justified regardless of the anchor point settings. The anchor point indicates where the origin of the text item is, and all transformations on the object will be relative to this point.
 
TextHAlignment getHorizontalAnchor () const
 
TextVAlignment getVerticalAnchor () const
 
float getGlyphSpacing () const
 
const std::shared_ptr< STK::Font > & getFont () const
 
float getWidth () const
 Returns the width (in pixels) of the entire text object.
 
float getHeight () const
 Returns the height (in pixels) of the entire text object.
 
float getMinX () const
 Returns the x position offset (in pixels) of the text object. This value depends on the anchor point settings used when creating the object.
 
float getMinY () const
 Returns the y position offset (in pixels) of the text object. This value depends on the anchor point settings used when creating the object.
 
void drawVertexArrays ()
 Low level rendering of the vertex arrays. Requires the correct texture and shader to be bound first.
 
const std::string & getText () const
 
const std::shared_ptr< STK::VertexBuffer2D > & getVertexBuffer () const
 

Protected Member Functions

void calcVertexArrays ()
 

Protected Attributes

std::shared_ptr< STK::Fontfont_
 
std::string text_
 
TextHAlignment h_anchor_ = TextHAlignment::Left
 
TextVAlignment v_anchor_ = TextVAlignment::Bottom
 
float glyph_spacing_ = 0.0
 
std::shared_ptr< STK::VertexBuffer2Dvtx_buffer_
 
uint32_t buffer_offset_ = 0
 
uint32_t buffer_count_ = 0
 
float x_min_ = 0
 
float y_min_ = 0
 
float width_ = 0
 
float height_ = 0
 

Detailed Description

TextItem - Low level 2D text item. This class contains the OpenGL vertex buffers for the glyphs of one text object. This class will normally not be used directly, but through a TextRenderItem.

Constructor & Destructor Documentation

◆ TextItem() [1/2]

STK::TextItem::TextItem ( std::shared_ptr< STK::Font font,
const std::string &  text,
TextHAlignment  h_anchor,
TextVAlignment  v_anchor,
float  glyph_spacing 
)
inline

Create a text item. The text will be split on newline characters and organized in lines. These lines will be left justified regardless of the anchor point settings. The anchor point indicates where the origin of the text item is, and all transformations on the object will be relative to this point.

Parameters
textInput text string to generate geometry for.
h_anchorHorizontal anchor point.
v_anchorVertical anchor point.

◆ TextItem() [2/2]

STK::TextItem::TextItem ( const std::shared_ptr< VertexBuffer2D > &  vtx_buffer,
std::shared_ptr< STK::Font font,
const std::string &  text,
TextHAlignment  h_anchor,
TextVAlignment  v_anchor,
float  glyph_spacing 
)
inline

Create a text item. The text will be split on newline characters and organized in lines. These lines will be left justified regardless of the anchor point settings. The anchor point indicates where the origin of the text item is, and all transformations on the object will be relative to this point.

Parameters
textInput text string to generate geometry for.
h_anchorHorizontal anchor point.
v_anchorVertical anchor point.

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