|
wavelength 1.0.0
|
Text drawn with a bitmap font as a mesh of one quad per character. More...
#include <rndtext.h>


Public Types | |
| enum | Align { kAlignLeft = 1 , kAlignCenter = 2 , kAlignRight = 4 , kAlignTop = 0x10 , kAlignMiddle = 0x20 , kAlignBottom = 0x40 } |
| The bits of mAlign, one vertical and one horizontal. More... | |
| Public Types inherited from RndTransformable | |
| enum | Billboard { kBillboardNone = 0 , kBillboardX = 1 , kBillboardY = 2 , kBillboardZ = 4 , kBillboardXZ = 8 , kBillboardXYZ = 16 , kBillboardSimpleXYZ = 32 , kBillboardLocalRotate = 64 , kBillboardScale = 128 , kBillboardScaleX = 129 , kBillboardScaleY = 130 , kBillboardScaleZ = 132 , kBillboardScaleXZ = 136 , kBillboardScaleXYZ = 144 , kBillboardScaleSimpleXYZ = 160 } |
| How the world transform turns to face the current camera. More... | |
Public Member Functions | |
| RndText (const char *pszName) | |
| Construct white, empty text aligned to the top left, without a font, wrapping at 100. | |
| ~RndText () override | |
| Drop the reference on the font and delete the mesh. | |
| void * | operator new (size_t nSize) |
| Allocate text, billed to the class name. | |
| void | operator delete (void *pBlock) |
| Release text. | |
| void | ListDrawObjects (std::list< RndObject * > &objects) override |
| Add the material of the mesh to a list. | |
| void | ListDrawables (std::list< RndDrawable * > &drawables) override |
| Add the text unless its mesh is outside the view of the current camera, then the children. | |
| void | SetShowing (int nShowing) override |
| Show or hide the text, building the mesh when it starts showing and deleting it when it stops. | |
| void | SetHighlight (int nHighlight) override |
| Set the highlight of the text and of its mesh. | |
| int | DrawShowing () override |
| Draw the mesh, or the text with the renderer's line font at the local position when there is no mesh. | |
| virtual void | SetColor (const Color &color) |
| Set the colour of every character. | |
| virtual void | SetAlign (int nAlign) |
| Set the alignment. | |
| virtual void | SetText (const char *pszText) |
| Set the text. | |
| virtual void | SetFont (RndFont *pFont) |
| Set the font. | |
| void | Collide (const Segment &segment, std::list< Collision > &collisions) override |
| Add each face of the mesh the segment strikes, as strikes of the text, then what the children strike, to a list. | |
| void | SetBillboard (int nBillboard) override |
| Set the billboard mode of the text and of its mesh. | |
| int | UpdateWorldXfm (RndTransformable *pParent, int bForce) override |
| Update the world transform of the text, then of its mesh from the text's. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the text and its bases. | |
| void | Save (BinStream &stream) override |
| Write the text and its bases. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace the font when it is the object being replaced. | |
| const char * | ClassName () const override |
| Report the class name. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy another text and its bases, then build the mesh again. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote, or an earlier version of it, then build the mesh. | |
| void | UpdateCursors () |
| Give the text again to every cursor that refers to it. | |
| void | SyncText () |
| Copy mPreWrapText to mText with each tab as three spaces, limit it to 800 characters, wrap it when word wrap is on, and build the mesh. | |
| void | SetWordWrap (int nWordWrap) |
| Turn word wrap on or off. | |
| void | SetWrapWidth (float fWrapWidth) |
| Set the width lines wrap at. | |
| void | SyncDepthTest () |
| Give the mesh the depth test mDepthTest selects. | |
| void | SetDepthTest (int nDepthTest) |
| Turn the depth test on or off. | |
| float | MeasureWidth (const char *pszText, int nCount) |
| Measure the advance of a run of characters, without the spacing. | |
| void | WrapText (const char *pszText, String &wrapped) |
| Break text into lines no wider than mWrapWidth, at the last space where there is one. | |
| int | NumLines () |
| Count the lines of mText. | |
| const char * | MeasureLine (const char *pszLine, float &fWidth) |
| Measure the line of mText that starts at a character, with the spacing. | |
| void | BuildMesh () |
| Build a mesh of one quad per character of mText, in the font's material. | |
| void | BuildLine (int nFirstChar, const char *pszStart, const char *pszEnd, float fLine, float fWidth) |
| Fill the quads of one line of the mesh. | |
| Vector3 | CharPosition (int nIndex) |
| Report the position of a character of mPreWrapText in the text's space. | |
| int | GetAlign () const |
| RndFont * | GetFont () const |
| const String & | GetPreWrapText () const |
| float | GetWrapWidth () const |
| virtual void | Collide (const Vector2 &point, std::list< Collision > &collisions) |
| Test a screen point against the collideable and add what it strikes to a list. | |
| Public Member Functions inherited from RndDrawable | |
| RndDrawable () | |
| Construct a showing drawable without a highlight or children. | |
| ~RndDrawable () override | |
| Drop the references on the children. | |
| RndDrawable * | Parent () |
| Find the drawable whose children include this one. | |
| void | Draw () |
| Draw the drawable and then its children, when it is showing. | |
| bool | AddDraw (RndDrawable *pDraw, RndDrawable *pBefore) |
| Add a child before another. | |
| void | RemoveDraw (RndDrawable *pDraw) |
| Remove a child. | |
| void | ClearDraws () |
| Remove every child. | |
| int | GetShowing () const |
| const std::list< RndDrawable * > & | GetDraws () const |
| Public Member Functions inherited from RndObject | |
| RndObject (const char *pszName) | |
| Construct an object and register it under a name. | |
| virtual | ~RndObject () |
| Notify every referrer, then erase the registration. | |
| void | SetName (const char *pszName) |
| Register the object under a different name. | |
| void | AddRef (RndObject *pReferrer) |
| Register an object as a store of a pointer to this one. | |
| void | RemoveRef (RndObject *pReferrer) |
| Drop the first registration AddRef() made for a referrer. | |
| const char * | GetName () const |
| const std::list< RndObject * > & | GetRefs () const |
| int | GetInternal () const |
| void | SetInternal (int nInternal) |
| Public Member Functions inherited from RndCollideable | |
| RndCollideable () | |
| Construct a collideable without children. | |
| ~RndCollideable () override | |
| Drop the references on the children. | |
| RndCollideable * | Parent () |
| Find the collideable whose children include this one. | |
| bool | AddCollide (RndCollideable *pCollide) |
| Append a child. | |
| void | RemoveCollide (RndCollideable *pCollide) |
| Remove a child. | |
| Public Member Functions inherited from RndTransformable | |
| RndTransformable () | |
| Construct a transformable with identity transforms, no origin offset, and no billboard. | |
| ~RndTransformable () override | |
| Drop the references on the children. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the transformable. | |
| void | Save (BinStream &stream) override |
| Write the transforms, the names of the children, the billboard mode, and the origin. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace a child with another object. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy the transforms, the billboard mode, the origin, and the children when the flags request them. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote, or an earlier version of it. | |
| void | SetOrigin (const Vector3 &origin) |
| Set the point the world transform subtracts first when there is no billboard. | |
| RndTransformable * | Parent () |
| Find the transformable whose children include this object. | |
| bool | AddTrans (RndTransformable *pTrans) |
| Append a child and mark its world transform dirty. | |
| void | RemoveTrans (RndTransformable *pTrans) |
| Remove a child. | |
| void | ClearTrans () |
| Remove every child. | |
| const Transform & | BillboardXfm () |
| Report the world transform turned to face the current camera. | |
| const Transform & | GetLocalXfm () const |
| Transform & | GetLocalXfm () |
| void | SetLocalXfm (const Transform &xfm) |
| const Transform & | GetWorldXfm () const |
| Transform & | GetWorldXfm () |
| int | GetDirty () const |
| void | SetDirty (int nDirty) |
| const std::list< RndTransformable * > & | GetTransList () const |
Static Public Member Functions | |
| static RndObject * | New (const char *pszName) |
| Create text. | |
| Static Public Member Functions inherited from RndDrawable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndDrawable *pDrawable) |
| Append every draw descendant of a drawable, depth first, each before its descendants. | |
| Static Public Member Functions inherited from RndCollideable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndCollideable *pCollideable) |
| Append every collision descendant of a collideable, depth first, each before its descendants. | |
| Static Public Member Functions inherited from RndTransformable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndTransformable *pTransformable) |
| Append every transform descendant of a transformable, depth first, each before its descendants. | |
Static Public Attributes | |
| static const char * | sClassName |
| The class name a .rnd file writes, Text. | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndDrawable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndObject | |
| static constexpr int | kCopyChildLists = 0x200 |
| The bit of the Copy() flags that copies the child lists of the mix-ins. | |
| Static Public Attributes inherited from RndCollideable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndTransformable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
Protected Member Functions | |
| void | ReleaseRefs () |
| Drop the reference on the font and delete the mesh. | |
| void | AcquireRefs () |
| Take a reference on the font and build the text again. | |
| Protected Member Functions inherited from RndDrawable | |
| void | ReleaseDrawRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireDrawRefs () |
| Take a reference on every child. | |
| Protected Member Functions inherited from RndCollideable | |
| void | ReleaseCollideRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireCollideRefs () |
| Take a reference on every child. | |
| Protected Member Functions inherited from RndTransformable | |
| void | ReleaseTransRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireTransRefs () |
| Take a reference on every child. | |
Additional Inherited Members | |
| Protected Attributes inherited from RndDrawable | |
| int | mShowing |
| Protected Attributes inherited from RndObject | |
| std::list< RndObject * > | mRefs |
| String | mName |
| Protected Attributes inherited from RndTransformable | |
| std::list< RndTransformable * > | mTransList |
| Transform | mLocalXfm |
| Transform | mWorldXfm |
| Vector3 | mOrigin |
| int | mDirty |
| int | mBillboard |
Text drawn with a bitmap font as a mesh of one quad per character.
The RTTI includes the class name and records RndDrawable, RndCollideable, and RndTransformable as bases. The mesh is rebuilt from mPreWrapText whenever the text, the font, or the layout changes, and only while the text is showing.
| enum RndText::Align |
The bits of mAlign, one vertical and one horizontal.
|
explicit |
Construct white, empty text aligned to the top left, without a font, wrapping at 100.
| pszName | The registry key. |
|
override |
Drop the reference on the font and delete the mesh.
|
inline |
Allocate text, billed to the class name.
| nSize | The object size the compiler supplies. |
|
inline |
Release text.
| pBlock | The block. |
|
overridevirtual |
Add the material of the mesh to a list.
Without a mesh nothing is added. The children are not added.
| objects | The list to add to. |
Reimplemented from RndDrawable.
|
overridevirtual |
Add the text unless its mesh is outside the view of the current camera, then the children.
The bounding sphere spans the first and the last vertex. Text without a mesh is not added.
| drawables | The list to add to. |
Reimplemented from RndDrawable.
|
overridevirtual |
Show or hide the text, building the mesh when it starts showing and deleting it when it stops.
The children are not changed.
| nShowing | Non-zero to show. |
Reimplemented from RndDrawable.
|
overridevirtual |
Set the highlight of the text and of its mesh.
| nHighlight | Non-zero to highlight. |
Reimplemented from RndDrawable.
|
overridevirtual |
Draw the mesh, or the text with the renderer's line font at the local position when there is no mesh.
Reimplemented from RndDrawable.
|
virtual |
Set the colour of every character.
| color | The colour. |
|
virtual |
Set the alignment.
| nAlign | The Align bits. |
|
virtual |
Set the text.
| pszText | The text. A newline starts a line. |
|
virtual |
Set the font.
| pFont | The font, or null. |
|
overridevirtual |
Add each face of the mesh the segment strikes, as strikes of the text, then what the children strike, to a list.
Hidden text adds nothing.
| segment | The segment, in world space. |
| collisions | The list to add to. |
Reimplemented from RndCollideable.
|
overridevirtual |
Set the billboard mode of the text and of its mesh.
| nBillboard | The Billboard mode. |
Reimplemented from RndTransformable.
|
overridevirtual |
Update the world transform of the text, then of its mesh from the text's.
| pParent | The parent, or null. |
| bForce | Non-zero to update even when the transform is not out of date. |
Reimplemented from RndTransformable.
|
overridevirtual |
Write a description of the text and its bases.
| stream | The stream to write to. |
Reimplemented from RndDrawable.
|
overridevirtual |
Write the text and its bases.
| stream | The stream to write to. |
Reimplemented from RndDrawable.
Replace the font when it is the object being replaced.
| pFrom | The object being replaced. |
| pTo | The replacement, or null. |
Reimplemented from RndDrawable.
|
inlineoverridevirtual |
Report the class name.
Implements RndObject.
|
overridevirtual |
Copy another text and its bases, then build the mesh again.
| pSource | The text to copy from. |
| nFlags | The set of fields to copy. |
Reimplemented from RndDrawable.
|
overridevirtual |
Read what Save() wrote, or an earlier version of it, then build the mesh.
| stream | The stream to read from. |
Reimplemented from RndDrawable.
| void RndText::UpdateCursors | ( | ) |
Give the text again to every cursor that refers to it.
| void RndText::SyncText | ( | ) |
Copy mPreWrapText to mText with each tab as three spaces, limit it to 800 characters, wrap it when word wrap is on, and build the mesh.
The name is inferred.
| void RndText::SetWordWrap | ( | int | nWordWrap | ) |
Turn word wrap on or off.
| nWordWrap | Non-zero to wrap. |
| void RndText::SetWrapWidth | ( | float | fWrapWidth | ) |
Set the width lines wrap at.
| fWrapWidth | The width. |
| void RndText::SyncDepthTest | ( | ) |
Give the mesh the depth test mDepthTest selects.
The name is inferred.
| void RndText::SetDepthTest | ( | int | nDepthTest | ) |
Turn the depth test on or off.
The name is inferred.
| nDepthTest | Non-zero to test depth. |
| float RndText::MeasureWidth | ( | const char * | pszText, |
| int | nCount ) |
Measure the advance of a run of characters, without the spacing.
| pszText | The characters. |
| nCount | The number of characters. |
| void RndText::WrapText | ( | const char * | pszText, |
| String & | wrapped ) |
Break text into lines no wider than mWrapWidth, at the last space where there is one.
The space stays at the end of its line. The name is inferred.
| pszText | The text. |
| wrapped | Receives the wrapped text. |
| int RndText::NumLines | ( | ) |
Count the lines of mText.
| const char * RndText::MeasureLine | ( | const char * | pszLine, |
| float & | fWidth ) |
Measure the line of mText that starts at a character, with the spacing.
The name is inferred.
| pszLine | The first character of the line. |
| fWidth | Receives the width. |
| void RndText::BuildMesh | ( | ) |
Build a mesh of one quad per character of mText, in the font's material.
Hidden text, text without a font, and empty text get no mesh. The name is inferred.
| void RndText::BuildLine | ( | int | nFirstChar, |
| const char * | pszStart, | ||
| const char * | pszEnd, | ||
| float | fLine, | ||
| float | fWidth ) |
Fill the quads of one line of the mesh.
The name is inferred.
| nFirstChar | The index of the line's first quad. |
| pszStart | The first character of the line. |
| pszEnd | The character after the end of the line. |
| fLine | The line's position, in lines from the origin. |
| fWidth | The width of the line. |
| Vector3 RndText::CharPosition | ( | int | nIndex | ) |
Report the position of a character of mPreWrapText in the text's space.
The name is inferred.
| nIndex | The index of the character. |
|
inlinestatic |
Create text.
| pszName | The registry key. |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
Drop the reference on the font and delete the mesh.
The name is inferred.
|
protected |
Take a reference on the font and build the text again.
The name is inferred.
|
virtual |
Test a screen point against the collideable and add what it strikes to a list.
The base body tests the children.
| point | The screen point. |
| collisions | The list to add to. |
Reimplemented from RndCollideable.
|
static |
The class name a .rnd file writes, Text.
|
static |