xoreos  0.0.5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Graphics::Aurora::Text Class Reference

A text object. More...

#include <text.h>

Inheritance diagram for Graphics::Aurora::Text:
Inheritance graph
[legend]
Collaboration diagram for Graphics::Aurora::Text:
Collaboration graph
[legend]

Public Member Functions

 Text (const FontHandle &font, const Common::UString &str, float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f, float halign=kHAlignLeft, float valign=kVAlignTop)
 
 Text (const FontHandle &font, float w, float h, const Common::UString &str, float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f, float halign=kHAlignLeft, float valign=kVAlignTop)
 
 Text (Graphics::GUIElement::GUIElementType type, const FontHandle &font, float w, float h, const Common::UString &str, float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f, float halign=kHAlignLeft, float valign=kVAlignTop)
 
 ~Text ()
 
const Common::UStringget () const
 
const Common::UStringgetFont () const
 
void getPosition (float &x, float &y, float &z) const
 
void getColor (float &r, float &g, float &b, float &a) const
 
float getHorizontalAlign () const
 
float getVerticalAlign () const
 
void set (const Common::UString &str, float maxWidth=0.0f, float maxHeight=0.0f)
 
void setText (const Common::UString &str)
 
void setPosition (float x, float y, float z=-FLT_MAX)
 
void setSize (float width, float height)
 
void setColor (float r, float g, float b, float a)
 
void unsetColor ()
 
void setHorizontalAlign (float halign)
 
void setVerticalAlign (float valign)
 
void setFont (const Common::UString &fnt)
 Change the font of the text. More...
 
void disableColorTokens (bool disabled)
 Disable parsing <c color tokens into actual coloring. More...
 
bool empty ()
 
float getHeight (const Common::UString &text) const
 
size_t getLineCount () const
 
float getWidth () const
 
float getHeight () const
 
void calculateDistance ()
 Calculate the object's distance. More...
 
void render (RenderPass pass)
 Render the object. More...
 
bool isIn (float x, float y) const
 Is that point within the object? More...
 
void renderImmediate (const glm::mat4 &parentTransform)
 For shader based systems, don't sort anything, render this right_now. More...
 
- Public Member Functions inherited from Graphics::GUIElement
 GUIElement (GUIElementType type)
 
 ~GUIElement ()
 
- Public Member Functions inherited from Graphics::Renderable
 Renderable (RenderableType type)
 
 ~Renderable ()
 
bool operator< (const Queueable &q) const
 
virtual void advanceTime (float dt)
 Advance time (used by renderables with animations). More...
 
virtual void queueRender (const glm::mat4 &parentTransform)
 Queue the object for later rendering. More...
 
double getDistance () const
 Get the distance of the object from the viewer. More...
 
uint32 getID () const
 Get the object's unique ID. More...
 
bool isClickable () const
 Is the object clickable? More...
 
void setClickable (bool clickable)
 Set the object's clickable state. More...
 
const Common::UStringgetTag () const
 Get the object's tag. More...
 
void setTag (const Common::UString &tag)
 Set the object's tag. More...
 
bool isVisible () const
 Is the object visible? More...
 
virtual void show ()
 Show the object. More...
 
virtual void hide ()
 Hide the object. More...
 
virtual bool isIn (float x, float y, float z) const
 Is that point within the object? More...
 
virtual bool isIn (float x1, float y1, float z1, float x2, float y2, float z2) const
 Does the line from x1.y1.z1 to x2.y2.z2 intersect with the object? More...
 
- Public Member Functions inherited from Graphics::Queueable
 Queueable ()
 
virtual ~Queueable ()
 

Private Member Functions

void parseColors (const Common::UString &str, Common::UString &parsed, ColorPositions &colors)
 
void drawLine (const Common::UString &line, ColorPositions::const_iterator color, size_t position)
 
void drawLineImmediate (const Common::UString &line, ColorPositions::const_iterator color, size_t position, float &x, float &y)
 

Private Attributes

float _r
 
float _g
 
float _b
 
float _a
 
FontHandle _font
 
float _x
 
float _y
 
size_t _lineCount
 
float _width
 
float _height
 
float _halign
 
float _valign
 
Common::UString _str
 
ColorPositions _colors
 
bool _disableColorTokens
 

Additional Inherited Members

- Public Types inherited from Graphics::GUIElement
enum  GUIElementType { kGUIElementFront = kRenderableTypeGUIFront, kGUIElementBack = kRenderableTypeGUIBack, kGUIElementConsole = kRenderableTypeConsole }
 
- Protected Member Functions inherited from Graphics::Renderable
void resort ()
 
void lockFrame ()
 
void unlockFrame ()
 
void lockFrameIfVisible ()
 
void unlockFrameIfVisible ()
 
- Protected Member Functions inherited from Graphics::Queueable
bool isInQueue (QueueType queue) const
 
void addToQueue (QueueType queue)
 
void removeFromQueue (QueueType queue)
 
void lockQueue (QueueType queue)
 
void unlockQueue (QueueType queue)
 
void sortQueue (QueueType queue)
 
- Protected Attributes inherited from Graphics::Renderable
QueueType _queueExists
 
QueueType _queueVisible
 
uint32 _id
 
bool _clickable
 
Common::UString _tag
 
double _distance
 The distance of the object from the viewer. More...
 

Detailed Description

A text object.

Definition at line 42 of file text.h.

Constructor & Destructor Documentation

◆ Text() [1/3]

Graphics::Aurora::Text::Text ( const FontHandle font,
const Common::UString str,
float  r = 1.0f,
float  g = 1.0f,
float  b = 1.0f,
float  a = 1.0f,
float  halign = kHAlignLeft,
float  valign = kVAlignTop 
)

Definition at line 36 of file text.cpp.

References Graphics::Renderable::_distance, and FLT_MAX.

◆ Text() [2/3]

Graphics::Aurora::Text::Text ( const FontHandle font,
float  w,
float  h,
const Common::UString str,
float  r = 1.0f,
float  g = 1.0f,
float  b = 1.0f,
float  a = 1.0f,
float  halign = kHAlignLeft,
float  valign = kVAlignTop 
)

Definition at line 47 of file text.cpp.

References Graphics::Renderable::_distance, _height, _width, FLT_MAX, and setText().

Here is the call graph for this function:

◆ Text() [3/3]

Graphics::Aurora::Text::Text ( Graphics::GUIElement::GUIElementType  type,
const FontHandle font,
float  w,
float  h,
const Common::UString str,
float  r = 1.0f,
float  g = 1.0f,
float  b = 1.0f,
float  a = 1.0f,
float  halign = kHAlignLeft,
float  valign = kVAlignTop 
)

Definition at line 61 of file text.cpp.

References Graphics::Renderable::_distance, _height, _width, FLT_MAX, and setText().

Here is the call graph for this function:

◆ ~Text()

Graphics::Aurora::Text::~Text ( )

Definition at line 75 of file text.cpp.

References Graphics::Renderable::hide().

Here is the call graph for this function:

Member Function Documentation

◆ calculateDistance()

void Graphics::Aurora::Text::calculateDistance ( )
virtual

Calculate the object's distance.

Implements Graphics::Renderable.

Definition at line 215 of file text.cpp.

◆ disableColorTokens()

void Graphics::Aurora::Text::disableColorTokens ( bool  disabled)

Disable parsing <c color tokens into actual coloring.

Definition at line 79 of file text.cpp.

References _disableColorTokens.

◆ drawLine()

void Graphics::Aurora::Text::drawLine ( const Common::UString line,
ColorPositions::const_iterator  color,
size_t  position 
)
private

Definition at line 391 of file text.cpp.

References _a, _b, _colors, _font, _g, _halign, _r, _width, Common::UString::begin(), Graphics::Font::draw(), Common::UString::end(), Graphics::Aurora::FontHandle::getFont(), and Graphics::Font::getLineWidth().

Referenced by render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawLineImmediate()

void Graphics::Aurora::Text::drawLineImmediate ( const Common::UString line,
ColorPositions::const_iterator  color,
size_t  position,
float &  x,
float &  y 
)
private

Definition at line 417 of file text.cpp.

References _a, _b, _colors, _font, _g, _halign, _r, _width, Common::UString::begin(), Common::UString::end(), Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getLineWidth(), and Graphics::Font::render().

Referenced by renderImmediate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty()

bool Graphics::Aurora::Text::empty ( )

Definition at line 195 of file text.cpp.

References _str, and Common::UString::empty().

Here is the call graph for this function:

◆ get()

const Common::UString & Graphics::Aurora::Text::get ( ) const

Definition at line 158 of file text.cpp.

References _str.

◆ getColor()

void Graphics::Aurora::Text::getColor ( float &  r,
float &  g,
float &  b,
float &  a 
) const

Definition at line 120 of file text.cpp.

References _a, _b, _g, and _r.

Referenced by Graphics::Aurora::HighlightableText::render().

Here is the caller graph for this function:

◆ getFont()

const Common::UString & Graphics::Aurora::Text::getFont ( ) const

Definition at line 162 of file text.cpp.

References _font, and Graphics::Aurora::FontHandle::getName().

Here is the call graph for this function:

◆ getHeight() [1/2]

float Graphics::Aurora::Text::getHeight ( const Common::UString text) const

Definition at line 199 of file text.cpp.

References _font, _width, Graphics::Aurora::FontHandle::getFont(), and Graphics::Font::getHeight().

Here is the call graph for this function:

◆ getHeight() [2/2]

float Graphics::Aurora::Text::getHeight ( ) const

Definition at line 211 of file text.cpp.

References _height.

◆ getHorizontalAlign()

float Graphics::Aurora::Text::getHorizontalAlign ( ) const

Definition at line 142 of file text.cpp.

References _halign.

◆ getLineCount()

size_t Graphics::Aurora::Text::getLineCount ( ) const

Definition at line 203 of file text.cpp.

References _lineCount.

◆ getPosition()

void Graphics::Aurora::Text::getPosition ( float &  x,
float &  y,
float &  z 
) const

Definition at line 166 of file text.cpp.

References Graphics::Renderable::_distance, _x, and _y.

◆ getVerticalAlign()

float Graphics::Aurora::Text::getVerticalAlign ( ) const

Definition at line 150 of file text.cpp.

References _valign.

◆ getWidth()

float Graphics::Aurora::Text::getWidth ( ) const

Definition at line 207 of file text.cpp.

References _width.

◆ isIn()

bool Graphics::Aurora::Text::isIn ( float  x,
float  y 
) const
virtual

Is that point within the object?

Reimplemented from Graphics::Renderable.

Definition at line 262 of file text.cpp.

References _height, _width, _x, and _y.

◆ parseColors()

void Graphics::Aurora::Text::parseColors ( const Common::UString str,
Common::UString parsed,
ColorPositions colors 
)
private

◆ render()

void Graphics::Aurora::Text::render ( RenderPass  pass)
virtual

Render the object.

Implements Graphics::Renderable.

Definition at line 218 of file text.cpp.

References _a, _b, _colors, _font, _g, _height, _r, _str, _valign, _width, _x, _y, drawLine(), Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getHeight(), Graphics::Font::getLineSpacing(), Graphics::kRenderPassOpaque, pass, and Graphics::Font::split().

Referenced by Graphics::Aurora::HighlightableText::render(), and Graphics::Aurora::FPS::render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderImmediate()

void Graphics::Aurora::Text::renderImmediate ( const glm::mat4 &  parentTransform)
virtual

For shader based systems, don't sort anything, render this right_now.

Reimplemented from Graphics::Renderable.

Definition at line 272 of file text.cpp.

References _colors, _font, _height, _str, _valign, _width, _x, _y, drawLineImmediate(), Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getHeight(), Graphics::Font::getLineSpacing(), Graphics::Font::renderBind(), Graphics::Font::renderUnbind(), and Graphics::Font::split().

Here is the call graph for this function:

◆ set()

void Graphics::Aurora::Text::set ( const Common::UString str,
float  maxWidth = 0.0f,
float  maxHeight = 0.0f 
)

◆ setColor()

void Graphics::Aurora::Text::setColor ( float  r,
float  g,
float  b,
float  a 
)

Definition at line 127 of file text.cpp.

References _a, _b, _g, _r, Graphics::Renderable::lockFrameIfVisible(), and Graphics::Renderable::unlockFrameIfVisible().

Referenced by Graphics::Aurora::HighlightableText::render(), and unsetColor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFont()

void Graphics::Aurora::Text::setFont ( const Common::UString fnt)

Change the font of the text.

Definition at line 387 of file text.cpp.

References _font, and FontMan.

◆ setHorizontalAlign()

void Graphics::Aurora::Text::setHorizontalAlign ( float  halign)

Definition at line 146 of file text.cpp.

References _halign.

◆ setPosition()

void Graphics::Aurora::Text::setPosition ( float  x,
float  y,
float  z = -FLT_MAX 
)

◆ setSize()

void Graphics::Aurora::Text::setSize ( float  width,
float  height 
)

Definition at line 184 of file text.cpp.

References _font, _height, _lineCount, _str, _width, Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getLineCount(), Graphics::Renderable::lockFrameIfVisible(), and Graphics::Renderable::unlockFrameIfVisible().

Referenced by Graphics::Aurora::FPS::notifyResized().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setText()

void Graphics::Aurora::Text::setText ( const Common::UString str)

◆ setVerticalAlign()

void Graphics::Aurora::Text::setVerticalAlign ( float  valign)

Definition at line 154 of file text.cpp.

References _valign.

◆ unsetColor()

void Graphics::Aurora::Text::unsetColor ( )

Definition at line 138 of file text.cpp.

References setColor().

Here is the call graph for this function:

Member Data Documentation

◆ _a

float Graphics::Aurora::Text::_a
private

Definition at line 95 of file text.h.

Referenced by drawLine(), drawLineImmediate(), getColor(), render(), and setColor().

◆ _b

float Graphics::Aurora::Text::_b
private

Definition at line 95 of file text.h.

Referenced by drawLine(), drawLineImmediate(), getColor(), render(), and setColor().

◆ _colors

ColorPositions Graphics::Aurora::Text::_colors
private

Definition at line 110 of file text.h.

Referenced by drawLine(), drawLineImmediate(), render(), renderImmediate(), set(), and setText().

◆ _disableColorTokens

bool Graphics::Aurora::Text::_disableColorTokens
private

Definition at line 112 of file text.h.

Referenced by disableColorTokens(), set(), and setText().

◆ _font

FontHandle Graphics::Aurora::Text::_font
private

◆ _g

float Graphics::Aurora::Text::_g
private

Definition at line 95 of file text.h.

Referenced by drawLine(), drawLineImmediate(), getColor(), render(), and setColor().

◆ _halign

float Graphics::Aurora::Text::_halign
private

Definition at line 106 of file text.h.

Referenced by drawLine(), drawLineImmediate(), getHorizontalAlign(), and setHorizontalAlign().

◆ _height

float Graphics::Aurora::Text::_height
private

Definition at line 104 of file text.h.

Referenced by getHeight(), isIn(), render(), renderImmediate(), set(), setSize(), setText(), and Text().

◆ _lineCount

size_t Graphics::Aurora::Text::_lineCount
private

Definition at line 101 of file text.h.

Referenced by getLineCount(), set(), setSize(), and setText().

◆ _r

float Graphics::Aurora::Text::_r
private

Definition at line 95 of file text.h.

Referenced by drawLine(), drawLineImmediate(), getColor(), render(), and setColor().

◆ _str

Common::UString Graphics::Aurora::Text::_str
private

Definition at line 109 of file text.h.

Referenced by empty(), get(), render(), renderImmediate(), set(), setSize(), and setText().

◆ _valign

float Graphics::Aurora::Text::_valign
private

Definition at line 107 of file text.h.

Referenced by getVerticalAlign(), render(), renderImmediate(), and setVerticalAlign().

◆ _width

float Graphics::Aurora::Text::_width
private

◆ _x

float Graphics::Aurora::Text::_x
private

Definition at line 98 of file text.h.

Referenced by getPosition(), isIn(), render(), renderImmediate(), and setPosition().

◆ _y

float Graphics::Aurora::Text::_y
private

Definition at line 99 of file text.h.

Referenced by getPosition(), isIn(), render(), renderImmediate(), and setPosition().


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