Pyrogenesis trunk
|
#include <TextRenderer.h>
Classes | |
struct | SBatch |
A list of SBatchRuns, with a single font/color/transform, to be rendered in a single GL call. More... | |
struct | SBatchRun |
A string (optionally owned by this object, or else pointing to an externally-owned string) with a position. More... | |
Public Member Functions | |
CTextRenderer () | |
void | ResetTranslate (const CVector2D &translate=CVector2D{}) |
Reset the text transform to the default, with (0,0) in the top-left corner. More... | |
const CVector2D & | GetTranslate () const |
void | Translate (float x, float y) |
void | SetClippingRect (const CRect &rect) |
Set clipping rectangle, in pre-transform coordinates (i.e. More... | |
void | SetCurrentColor (const CColor &color) |
Set the color for subsequent print calls. More... | |
void | SetCurrentFont (CStrIntern font) |
Set the font for subsequent print calls. More... | |
void | PrintfAdvance (const wchar_t *fmt,...) |
Print formatted text at (0,0) under the current transform, and advance the transform by the width of the text. More... | |
void | PrintfAt (float x, float y, const wchar_t *fmt,...) |
Print formatted text at (x,y) under the current transform. More... | |
void | PutAdvance (const wchar_t *buf) |
Print text at (0,0) under the current transform, and advance the transform by the width of the text. More... | |
void | Put (float x, float y, const wchar_t *buf) |
Print text at (x,y) under the current transform. More... | |
void | Put (float x, float y, const char *buf) |
Print text at (x,y) under the current transform. More... | |
void | Put (float x, float y, const std::wstring *buf) |
Print text at (x,y) under the current transform. More... | |
void | Render (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, Renderer::Backend::IShaderProgram *shader, const CVector2D &transformScale, const CVector2D &translation) |
Render all of the previously printed text calls. More... | |
Private Member Functions | |
void | PutString (float x, float y, const std::wstring *buf, bool owned) |
Private Attributes | |
CVector2D | m_Translate |
CRect | m_Clipping |
CColor | m_Color |
CStrIntern | m_FontName |
std::shared_ptr< CFont > | m_Font |
bool | m_Dirty = true |
std::list< SBatch > | m_Batches |
Friends | |
struct | SBatchCompare |
CTextRenderer::CTextRenderer | ( | ) |
|
inline |
void CTextRenderer::PrintfAdvance | ( | const wchar_t * | fmt, |
... | |||
) |
Print formatted text at (0,0) under the current transform, and advance the transform by the width of the text.
void CTextRenderer::PrintfAt | ( | float | x, |
float | y, | ||
const wchar_t * | fmt, | ||
... | |||
) |
Print formatted text at (x,y) under the current transform.
Does not alter the current transform.
void CTextRenderer::Put | ( | float | x, |
float | y, | ||
const char * | buf | ||
) |
Print text at (x,y) under the current transform.
Does not alter the current transform. buf
must be a UTF-8 string.
void CTextRenderer::Put | ( | float | x, |
float | y, | ||
const std::wstring * | buf | ||
) |
Print text at (x,y) under the current transform.
Does not alter the current transform. buf
must remain valid until Render() is called. (This should be used to minimise memory copies when possible.)
void CTextRenderer::Put | ( | float | x, |
float | y, | ||
const wchar_t * | buf | ||
) |
Print text at (x,y) under the current transform.
Does not alter the current transform.
void CTextRenderer::PutAdvance | ( | const wchar_t * | buf | ) |
Print text at (0,0) under the current transform, and advance the transform by the width of the text.
|
private |
void CTextRenderer::Render | ( | Renderer::Backend::IDeviceCommandContext * | deviceCommandContext, |
Renderer::Backend::IShaderProgram * | shader, | ||
const CVector2D & | transformScale, | ||
const CVector2D & | translation | ||
) |
Render all of the previously printed text calls.
Reset the text transform to the default, with (0,0) in the top-left corner.
void CTextRenderer::SetClippingRect | ( | const CRect & | rect | ) |
Set clipping rectangle, in pre-transform coordinates (i.e.
text is clipped against this rect based purely on the x,y values passed into Put()). Text fully outside the clipping rectangle may not be rendered. Should be used in conjunction with SetScissors for precise clipping - this is just an optimisation.
void CTextRenderer::SetCurrentColor | ( | const CColor & | color | ) |
Set the color for subsequent print calls.
void CTextRenderer::SetCurrentFont | ( | CStrIntern | font | ) |
Set the font for subsequent print calls.
void CTextRenderer::Translate | ( | float | x, |
float | y | ||
) |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |