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 (const CShaderProgramPtr &shader) | |
void | ResetTransform () |
Reset the text transform to the default, with (0,0) in the top-left of the screen. More... | |
CMatrix3D | GetTransform () |
void | SetTransform (const CMatrix3D &transform) |
void | Translate (float x, float y, float z) |
void | SetClippingRect (const CRect &rect) |
Set clipping rectangle, in pre-transform coordinates (i.e. More... | |
void | Color (const CColor &color) |
Set the color for subsequent print calls. More... | |
void | Color (float r, float g, float b, float a=1.0) |
Set the color for subsequent print calls. More... | |
void | Font (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 () |
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 | |
CShaderProgramPtr | m_Shader |
CMatrix3D | m_Transform |
CRect | m_Clipping |
CColor | m_Color |
CStrIntern | m_FontName |
shared_ptr< CFont > | m_Font |
bool | m_Dirty |
std::list< SBatch > | m_Batches |
Friends | |
struct | SBatchCompare |
CTextRenderer::CTextRenderer | ( | const CShaderProgramPtr & | shader | ) |
void CTextRenderer::Color | ( | const CColor & | color | ) |
Set the color for subsequent print calls.
void CTextRenderer::Color | ( | float | r, |
float | g, | ||
float | b, | ||
float | a = 1.0 |
||
) |
Set the color for subsequent print calls.
void CTextRenderer::Font | ( | CStrIntern | font | ) |
Set the font for subsequent print calls.
CMatrix3D CTextRenderer::GetTransform | ( | ) |
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 wchar_t * | buf | ||
) |
Print 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::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 | ( | ) |
Render all of the previously printed text calls.
void CTextRenderer::ResetTransform | ( | ) |
Reset the text transform to the default, with (0,0) in the top-left of the screen.
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 glScissor for precise clipping - this is just an optimisation.
void CTextRenderer::SetTransform | ( | const CMatrix3D & | transform | ) |
void CTextRenderer::Translate | ( | float | x, |
float | y, | ||
float | z | ||
) |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |