Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
An CGUIText object is a parsed string, divided into text-rendering components. More...
#include <CGUIText.h>
Classes | |
struct | SSpriteCall |
A sprite call to the CRenderer. More... | |
struct | STextCall |
A text call to the CRenderer. More... | |
Public Member Functions | |
NONCOPYABLE (CGUIText) | |
MOVABLE (CGUIText) | |
CGUIText ()=default | |
Generates empty text. More... | |
CGUIText (const CGUI &pGUI, const CGUIString &string, const CStrW &fontW, const float width, const float bufferZone, const EAlign align, const IGUIObject *pObject) | |
Generate a CGUIText object from the inputted string. More... | |
void | Draw (CGUI &pGUI, CCanvas2D &canvas, const CGUIColor &DefaultColor, const CVector2D &pos, CRect clipping) const |
Draw this CGUIText object. More... | |
const CSize2D & | GetSize () const |
const std::list< SSpriteCall > & | GetSpriteCalls () const |
const std::vector< STextCall > & | GetTextCalls () const |
bool | ProcessLine (const CGUI &pGUI, const CGUIString &string, const CStrIntern &font, const IGUIObject *pObject, const SGenerateTextImages &images, const EAlign align, const float prelimLineHeight, const float width, const float bufferZone, bool &firstLine, float &y, int &i, int &from) |
void | SetupSpriteCalls (const CGUI &pGUI, const std::array< std::vector< CStr >, 2 > &feedbackImages, const float y, const float width, const float bufferZone, const int i, const int posLastImage, SGenerateTextImages &images) |
float | GetLineOffset (const EAlign align, const float widthRangeFrom, const float widthRangeTo, const CSize2D &lineSize) const |
void | ComputeLineRange (const SGenerateTextImages &images, const float y, const float width, const float prelimLineHeight, float &widthRangeFrom, float &widthRangeTo) const |
void | ComputeLineSize (const CGUI &pGUI, const CGUIString &string, const CStrIntern &font, const bool firstLine, const float width, const float widthRangeFrom, const float widthRangeTo, const int i, const int tempFrom, CSize2D &lineSize) const |
bool | AssembleCalls (const CGUI &pGUI, const CGUIString &string, const CStrIntern &font, const IGUIObject *pObject, const bool firstLine, const float width, const float widthRangeTo, const float dx, const float y, const int tempFrom, const int i, int &from) |
Public Attributes | |
std::vector< STextCall > | m_TextCalls |
List of TextCalls, for instance "Hello", "there!". More... | |
std::list< SSpriteCall > | m_SpriteCalls |
List of sprites, or "icons" that should be rendered along with the text. More... | |
CSize2D | m_Size |
Width and height of the whole output, used when setting up scrollbars and such. More... | |
An CGUIText object is a parsed string, divided into text-rendering components.
Each component, being a call to the Renderer. For instance, if you by tags change the color, then the GUI will have to make individual calls saying it want that color on the text.
For instance: "Hello [b]there[/b] bunny!"
That without word-wrapping would mean 3 components. i.e. 3 calls to CRenderer. One drawing "Hello", one drawing "there" in bold, and one drawing "bunny!".
|
default |
Generates empty text.
CGUIText::CGUIText | ( | const CGUI & | pGUI, |
const CGUIString & | string, | ||
const CStrW & | fontW, | ||
const float | width, | ||
const float | bufferZone, | ||
const EAlign | align, | ||
const IGUIObject * | pObject | ||
) |
Generate a CGUIText object from the inputted string.
The function will break down the string and its tags to calculate exactly which rendering queries will be sent to the Renderer. Also, horizontal alignment is taken into acount in this method but NOT vertical alignment.
string | Text to generate CGUIText object from. |
font | Default font, notice both Default color and default font can be changed by tags. |
width | Width, 0 if no word-wrapping. |
bufferZone | Space between text and edge, and space between text and images. |
align | Horizontal alignment (left / center / right). |
pObject | Optional parameter for error output. Used only if error parsing fails, and we need to be able to output which object the error occurred in to aid the user. |
bool CGUIText::AssembleCalls | ( | const CGUI & | pGUI, |
const CGUIString & | string, | ||
const CStrIntern & | font, | ||
const IGUIObject * | pObject, | ||
const bool | firstLine, | ||
const float | width, | ||
const float | widthRangeTo, | ||
const float | dx, | ||
const float | y, | ||
const int | tempFrom, | ||
const int | i, | ||
int & | from | ||
) |
void CGUIText::ComputeLineRange | ( | const SGenerateTextImages & | images, |
const float | y, | ||
const float | width, | ||
const float | prelimLineHeight, | ||
float & | widthRangeFrom, | ||
float & | widthRangeTo | ||
) | const |
void CGUIText::ComputeLineSize | ( | const CGUI & | pGUI, |
const CGUIString & | string, | ||
const CStrIntern & | font, | ||
const bool | firstLine, | ||
const float | width, | ||
const float | widthRangeFrom, | ||
const float | widthRangeTo, | ||
const int | i, | ||
const int | tempFrom, | ||
CSize2D & | lineSize | ||
) | const |
void CGUIText::Draw | ( | CGUI & | pGUI, |
CCanvas2D & | canvas, | ||
const CGUIColor & | DefaultColor, | ||
const CVector2D & | pos, | ||
CRect | clipping | ||
) | const |
Draw this CGUIText object.
float CGUIText::GetLineOffset | ( | const EAlign | align, |
const float | widthRangeFrom, | ||
const float | widthRangeTo, | ||
const CSize2D & | lineSize | ||
) | const |
|
inline |
|
inline |
|
inline |
CGUIText::MOVABLE | ( | CGUIText | ) |
CGUIText::NONCOPYABLE | ( | CGUIText | ) |
bool CGUIText::ProcessLine | ( | const CGUI & | pGUI, |
const CGUIString & | string, | ||
const CStrIntern & | font, | ||
const IGUIObject * | pObject, | ||
const SGenerateTextImages & | images, | ||
const EAlign | align, | ||
const float | prelimLineHeight, | ||
const float | width, | ||
const float | bufferZone, | ||
bool & | firstLine, | ||
float & | y, | ||
int & | i, | ||
int & | from | ||
) |
void CGUIText::SetupSpriteCalls | ( | const CGUI & | pGUI, |
const std::array< std::vector< CStr >, 2 > & | feedbackImages, | ||
const float | y, | ||
const float | width, | ||
const float | bufferZone, | ||
const int | i, | ||
const int | posLastImage, | ||
SGenerateTextImages & | images | ||
) |
CSize2D CGUIText::m_Size |
Width and height of the whole output, used when setting up scrollbars and such.
std::list<SSpriteCall> CGUIText::m_SpriteCalls |
List of sprites, or "icons" that should be rendered along with the text.
std::vector<STextCall> CGUIText::m_TextCalls |
List of TextCalls, for instance "Hello", "there!".