xoreos
0.0.5
|
A text object. More...
#include <text.h>
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::UString & | get () const |
const Common::UString & | getFont () 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::UString & | getTag () 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... | |
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.
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 |
||
) |
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 |
||
) |
Graphics::Aurora::Text::~Text | ( | ) |
Definition at line 75 of file text.cpp.
References Graphics::Renderable::hide().
|
virtual |
Calculate the object's distance.
Implements Graphics::Renderable.
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.
|
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().
|
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().
bool Graphics::Aurora::Text::empty | ( | ) |
Definition at line 195 of file text.cpp.
References _str, and Common::UString::empty().
const Common::UString & Graphics::Aurora::Text::get | ( | ) | const |
void Graphics::Aurora::Text::getColor | ( | float & | r, |
float & | g, | ||
float & | b, | ||
float & | a | ||
) | const |
const Common::UString & Graphics::Aurora::Text::getFont | ( | ) | const |
Definition at line 162 of file text.cpp.
References _font, and Graphics::Aurora::FontHandle::getName().
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().
float Graphics::Aurora::Text::getHeight | ( | ) | const |
float Graphics::Aurora::Text::getHorizontalAlign | ( | ) | const |
size_t Graphics::Aurora::Text::getLineCount | ( | ) | const |
Definition at line 203 of file text.cpp.
References _lineCount.
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.
float Graphics::Aurora::Text::getVerticalAlign | ( | ) | const |
float Graphics::Aurora::Text::getWidth | ( | ) | const |
|
virtual |
|
private |
Definition at line 303 of file text.cpp.
References Graphics::ColorPosition::a, Graphics::ColorPosition::b, Common::UString::begin(), Common::UString::clear(), Graphics::ColorPosition::defaultColor, Graphics::ColorPosition::g, Graphics::ColorPosition::position, Graphics::ColorPosition::r, Common::UString::size(), and Common::UString::splitTextTokens().
Referenced by set(), and setText().
|
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().
|
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().
void Graphics::Aurora::Text::set | ( | const Common::UString & | str, |
float | maxWidth = 0.0f , |
||
float | maxHeight = 0.0f |
||
) |
Definition at line 83 of file text.cpp.
References _colors, _disableColorTokens, _font, _height, _lineCount, _str, _width, Graphics::Font::buildChars(), Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getHeight(), Graphics::Font::getLineCount(), Graphics::Font::getWidth(), Graphics::Renderable::lockFrameIfVisible(), parseColors(), and Graphics::Renderable::unlockFrameIfVisible().
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().
void Graphics::Aurora::Text::setFont | ( | const Common::UString & | fnt | ) |
void Graphics::Aurora::Text::setHorizontalAlign | ( | float | halign | ) |
void Graphics::Aurora::Text::setPosition | ( | float | x, |
float | y, | ||
float | z = -FLT_MAX |
||
) |
Definition at line 172 of file text.cpp.
References Graphics::Renderable::_distance, _x, _y, Graphics::Renderable::lockFrameIfVisible(), Graphics::Renderable::resort(), and Graphics::Renderable::unlockFrameIfVisible().
Referenced by Graphics::Aurora::FPS::notifyResized(), Engines::Sonic::Game::showMainMenu(), and Engines::Sonic::Game::showQuote().
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().
void Graphics::Aurora::Text::setText | ( | const Common::UString & | str | ) |
Definition at line 103 of file text.cpp.
References _colors, _disableColorTokens, _font, _height, _lineCount, _str, _width, Graphics::Font::buildChars(), Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getLineCount(), Graphics::Renderable::lockFrameIfVisible(), parseColors(), and Graphics::Renderable::unlockFrameIfVisible().
Referenced by Graphics::Aurora::FPS::render(), and Text().
void Graphics::Aurora::Text::setVerticalAlign | ( | float | valign | ) |
void Graphics::Aurora::Text::unsetColor | ( | ) |
Definition at line 138 of file text.cpp.
References setColor().
|
private |
Definition at line 95 of file text.h.
Referenced by drawLine(), drawLineImmediate(), getColor(), render(), and setColor().
|
private |
Definition at line 95 of file text.h.
Referenced by drawLine(), drawLineImmediate(), getColor(), render(), and setColor().
|
private |
Definition at line 110 of file text.h.
Referenced by drawLine(), drawLineImmediate(), render(), renderImmediate(), set(), and setText().
|
private |
Definition at line 112 of file text.h.
Referenced by disableColorTokens(), set(), and setText().
|
private |
Definition at line 96 of file text.h.
Referenced by drawLine(), drawLineImmediate(), getFont(), getHeight(), render(), renderImmediate(), set(), setFont(), setSize(), and setText().
|
private |
Definition at line 95 of file text.h.
Referenced by drawLine(), drawLineImmediate(), getColor(), render(), and setColor().
|
private |
Definition at line 106 of file text.h.
Referenced by drawLine(), drawLineImmediate(), getHorizontalAlign(), and setHorizontalAlign().
|
private |
Definition at line 104 of file text.h.
Referenced by getHeight(), isIn(), render(), renderImmediate(), set(), setSize(), setText(), and Text().
|
private |
|
private |
Definition at line 95 of file text.h.
Referenced by drawLine(), drawLineImmediate(), getColor(), render(), and setColor().
|
private |
|
private |
Definition at line 107 of file text.h.
Referenced by getVerticalAlign(), render(), renderImmediate(), and setVerticalAlign().
|
private |
Definition at line 103 of file text.h.
Referenced by drawLine(), drawLineImmediate(), getHeight(), getWidth(), isIn(), render(), renderImmediate(), set(), setSize(), setText(), and Text().
|
private |
Definition at line 98 of file text.h.
Referenced by getPosition(), isIn(), render(), renderImmediate(), and setPosition().
|
private |
Definition at line 99 of file text.h.
Referenced by getPosition(), isIn(), render(), renderImmediate(), and setPosition().