UTextContext implementation. More...
#include <text_context_user.h>
Inherits NL3D::UTextContext.
Public Member Functions | |
| CTextContextUser (const std::string fontFileName, const std::string fontExFileName, CDriverUser *drv, CFontManager *fmg) | |
| Constructor. | |
| virtual | ~CTextContextUser () |
| void | dumpCacheTexture (const char *filename) |
| Used for debug. | |
| virtual URenderStringBuffer * | createRenderBuffer () |
| create a renderBuffer for printClipAt(). Must delete it with deleteRenderBuffer() | |
| virtual void | deleteRenderBuffer (URenderStringBuffer *buffer) |
| virtual void | flushRenderBuffer (URenderStringBuffer *buffer) |
| Flush the rendered string buffer. This method sets the driver matrix to a 2d11 matrix and sets ztest to always and disable z write. | |
| virtual void | flushRenderBufferUnProjected (URenderStringBuffer *buffer, bool zwrite) |
| Flush the rendered string buffer. This method doesn't change the current matrices nor the material properties. | |
| CTextContext & | getTextContext () |
Text look. | |
| void | setColor (NLMISC::CRGBA color) |
| set the font color | |
| void | setFontSize (uint32 fontSize) |
| set the font size. | |
| uint32 | getFontSize () const |
| get the font size | |
| void | setHotSpot (THotSpot hotSpot) |
| set the hot spot | |
| THotSpot | getHotSpot () const |
| get the hot spot | |
| void | setScaleX (float scaleX) |
| set the X scale | |
| void | setScaleY (float scaleY) |
| set the Y scale | |
| float | getScaleX () const |
| float | getScaleY () const |
| void | setShaded (bool b) |
| set the shade states | |
| bool | getShaded () const |
| void | setShadeExtent (float shext) |
| set the shadow's size | |
| void | setShadeColor (NLMISC::CRGBA sc) |
| set the shadow's color The alpha of the shade is multiplied at each draw with the alpha of the color. | |
| NLMISC::CRGBA | getShadeColor () const |
| get the shadow's color the shadow color | |
| void | setKeep800x600Ratio (bool keep) |
| set to true if you want that the font manager look at Driver window size, and resize fontSize so it keeps same size than if it was in 800x600. | |
| bool | getKeep800x600Ratio () const |
| return keep800x600Ratio state. | |
Rendering. | |
| uint32 | textPush (const char *format,...) |
| All rendering are done in current UDriver matrix context. | |
| uint32 | textPush (const ucstring &str) |
| computes an ucstring and adds the result to the stack | |
| void | setStringColor (uint32 i, CRGBA newCol) |
| set the color of a string. | |
| void | setStringSelection (uint32 i, uint32 selectStart, uint32 selectSize) |
| set the letter selection of a string. | |
| void | resetStringSelection (uint32 i) |
| reset the letter selection of a string to 0/0xFFFFFFFF (all displayed) | |
| void | erase (uint32 i) |
| remove a string from the list | |
| virtual CStringInfo | getStringInfo (uint32 i) |
| Get a string information from the list. | |
| virtual CStringInfo | getStringInfo (const ucstring &ucstr) |
| Get a string information from the ucstring The returned string info is in pixel size per default. | |
| void | clear () |
| empty the map | |
| void | printAt (float x, float y, uint32 i) |
| print a string of the list (2D method). | |
| void | printClipAt (URenderStringBuffer &renderBuffer, float x, float y, uint32 i, float xmin, float ymin, float xmax, float ymax) |
| Same as printAt but special version for interface: clip and insert in a temp buffer. | |
| void | printClipAtUnProjected (URenderStringBuffer &renderBuffer, class NL3D::CFrustum &frustum, const NLMISC::CMatrix &scaleMatrix, float x, float y, float depth, uint32 i, float xmin, float ymin, float xmax, float ymax) |
| Same as printClipAt but special version for planar 3d interface: the final vertices are unproject using a frustum. | |
| void | printClipAtOld (float x, float y, uint32 i, float xmin, float ymin, float xmax, float ymax) |
| void | printAt (float x, float y, const ucstring &ucstr) |
| compute and print a ucstring at the location (2D method) x/y E [0,1] | |
| void | printfAt (float x, float y, const char *format,...) |
| compute and print a string at the location (2D method) x/y E [0,1] | |
| void | render3D (const CMatrix &mat, const ucstring &ucstr) |
| compute and render a ucstring at the location (3D method) render3D() use UDriver Matrix context for Frustum/ViewMatrix, but use its own modelmatrix (mat). | |
| void | render3D (const CMatrix &mat, const char *format,...) |
| compute and render a string at the location (3D method) render3D() use UDriver Matrix context for Frustum/ViewMatrix, but use its own modelmatrix (mat). | |
| float | getLastXBound () const |
| Return max x coordinate of last string printed. | |
| virtual void | setLetterColors (ULetterColors *letterColors, uint index) |
| colors in single line mode. | |
| virtual bool | isSameLetterColors (ULetterColors *letterColors, uint index) |
| virtual ULetterColors * | createLetterColors () |
Private Attributes | |
| CTextContext | _TextContext |
| CDriverUser * | _DriverUser |
| IDriver * | _Driver |
| CComputedString | _CacheString |
UTextContext implementation.
Definition at line 43 of file text_context_user.h.
| NL3D::CTextContextUser::CTextContextUser | ( | const std::string | fontFileName, | |
| const std::string | fontExFileName, | |||
| CDriverUser * | drv, | |||
| CFontManager * | fmg | |||
| ) | [inline] |
Constructor.
Definition at line 54 of file text_context_user.h.
References _Driver, _DriverUser, _TextContext, NL3D::CDriverUser::getDriver(), NL3D::CComputedString::HotSpotCount, NL3D::UTextContext::HotSpotCount, NL3D::CTextContext::init(), nlassert, and NL3D::CTextContext::setFontGenerator().
| virtual NL3D::CTextContextUser::~CTextContextUser | ( | ) | [inline, virtual] |
Definition at line 66 of file text_context_user.h.
| void NL3D::CTextContextUser::clear | ( | ) | [virtual] |
empty the map
Implements NL3D::UTextContext.
Definition at line 254 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::clear(), and H_AUTO2.
| ULetterColors * NL3D::CTextContextUser::createLetterColors | ( | ) | [virtual] |
Implements NL3D::UTextContext.
Definition at line 390 of file text_context_user.cpp.
References H_AUTO2.
| URenderStringBuffer * NL3D::CTextContextUser::createRenderBuffer | ( | ) | [virtual] |
create a renderBuffer for printClipAt(). Must delete it with deleteRenderBuffer()
Implements NL3D::UTextContext.
Definition at line 344 of file text_context_user.cpp.
| void NL3D::CTextContextUser::deleteRenderBuffer | ( | URenderStringBuffer * | buffer | ) | [virtual] |
Implements NL3D::UTextContext.
Definition at line 350 of file text_context_user.cpp.
| void NL3D::CTextContextUser::dumpCacheTexture | ( | const char * | filename | ) | [virtual] |
Used for debug.
Implements NL3D::UTextContext.
Definition at line 337 of file text_context_user.cpp.
References _TextContext, and NL3D::CTextContext::dumpCache().
| void NL3D::CTextContextUser::erase | ( | uint32 | i | ) | [virtual] |
remove a string from the list
Implements NL3D::UTextContext.
Definition at line 231 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::erase(), and H_AUTO2.
| void NL3D::CTextContextUser::flushRenderBuffer | ( | URenderStringBuffer * | buffer | ) | [virtual] |
Flush the rendered string buffer. This method sets the driver matrix to a 2d11 matrix and sets ztest to always and disable z write.
Implements NL3D::UTextContext.
Definition at line 356 of file text_context_user.cpp.
References _Driver, _DriverUser, _TextContext, NL3D::CRenderStringBuffer::flush(), NL3D::CTextContext::getFontManager(), NL3D::CFontManager::getFontMaterial(), nlassert, NL3D::CRenderStringBuffer::NumQuads, and NL3D::CDriverUser::restoreMatrixContextMatrixOnly().
Referenced by printClipAtOld().
| void NL3D::CTextContextUser::flushRenderBufferUnProjected | ( | URenderStringBuffer * | buffer, | |
| bool | zwrite | |||
| ) | [virtual] |
Flush the rendered string buffer. This method doesn't change the current matrices nor the material properties.
Implements NL3D::UTextContext.
Definition at line 370 of file text_context_user.cpp.
References _Driver, _TextContext, NL3D::CRenderStringBuffer::flushUnProjected(), NL3D::CTextContext::getFontManager(), NL3D::CFontManager::getFontMaterial(), nlassert, and NL3D::CRenderStringBuffer::NumQuads.
| uint32 NL3D::CTextContextUser::getFontSize | ( | ) | const [virtual] |
get the font size
Implements NL3D::UTextContext.
Definition at line 104 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getFontSize(), and H_AUTO2.
| UTextContext::THotSpot NL3D::CTextContextUser::getHotSpot | ( | ) | const [virtual] |
get the hot spot
Implements NL3D::UTextContext.
Definition at line 116 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getHotSpot(), and H_AUTO2.
| bool NL3D::CTextContextUser::getKeep800x600Ratio | ( | ) | const [virtual] |
return keep800x600Ratio state.
Implements NL3D::UTextContext.
Definition at line 182 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getKeep800x600Ratio(), and H_AUTO2.
| float NL3D::CTextContextUser::getLastXBound | ( | ) | const [virtual] |
Return max x coordinate of last string printed.
Useful to know if a string goes out of the screen (screen limit is supposed at x==4/3, should actually depend on driver's frustum).
Implements NL3D::UTextContext.
Definition at line 329 of file text_context_user.cpp.
References H_AUTO2.
| float NL3D::CTextContextUser::getScaleX | ( | ) | const [virtual] |
Implements NL3D::UTextContext.
Definition at line 134 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getScaleX(), and H_AUTO2.
| float NL3D::CTextContextUser::getScaleY | ( | ) | const [virtual] |
Implements NL3D::UTextContext.
Definition at line 140 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getScaleZ(), and H_AUTO2.
| NLMISC::CRGBA NL3D::CTextContextUser::getShadeColor | ( | ) | const [virtual] |
get the shadow's color the shadow color
Implements NL3D::UTextContext.
Definition at line 170 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getShadeColor(), and H_AUTO2.
| bool NL3D::CTextContextUser::getShaded | ( | ) | const [virtual] |
Implements NL3D::UTextContext.
Definition at line 152 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getShaded(), and H_AUTO2.
| UTextContext::CStringInfo NL3D::CTextContextUser::getStringInfo | ( | const ucstring & | ucstr | ) | [virtual] |
Get a string information from the ucstring The returned string info is in pixel size per default.
Implements NL3D::UTextContext.
Definition at line 247 of file text_context_user.cpp.
References _CacheString, _TextContext, NL3D::CTextContext::computeStringInfo(), H_AUTO2, NL3D::CComputedString::StringHeight, NL3D::CComputedString::StringLine, and NL3D::CComputedString::StringWidth.
| UTextContext::CStringInfo NL3D::CTextContextUser::getStringInfo | ( | uint32 | i | ) | [virtual] |
Get a string information from the list.
return CStringInfo(0,0) if not found. The returned string info is in pixel size per default.
Implements NL3D::UTextContext.
Definition at line 237 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getComputedString(), H_AUTO2, NL3D::CComputedString::StringHeight, NL3D::CComputedString::StringLine, and NL3D::CComputedString::StringWidth.
| CTextContext& NL3D::CTextContextUser::getTextContext | ( | ) | [inline] |
Definition at line 128 of file text_context_user.h.
References _TextContext.
| bool NL3D::CTextContextUser::isSameLetterColors | ( | ULetterColors * | letterColors, | |
| uint | index | |||
| ) | [virtual] |
Implements NL3D::UTextContext.
Definition at line 398 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::isSameLetterColors().
compute and print a ucstring at the location (2D method) x/y E [0,1]
Implements NL3D::UTextContext.
Definition at line 287 of file text_context_user.cpp.
References _DriverUser, _TextContext, H_AUTO2, NL3D::CTextContext::printAt(), and NL3D::CDriverUser::restoreMatrixContext().
print a string of the list (2D method).
x/y E [0,1] (rq : it leaves the string in the stack) z : if the hotspot is bottom z is the position of the line of the string, not the bottom of the string bounding box !
Implements NL3D::UTextContext.
Definition at line 260 of file text_context_user.cpp.
References _DriverUser, _TextContext, H_AUTO2, NL3D::CTextContext::printAt(), and NL3D::CDriverUser::restoreMatrixContext().
| void NL3D::CTextContextUser::printClipAt | ( | URenderStringBuffer & | renderBuffer, | |
| float | x, | |||
| float | y, | |||
| uint32 | i, | |||
| float | xmin, | |||
| float | ymin, | |||
| float | xmax, | |||
| float | ymax | |||
| ) | [virtual] |
Same as printAt but special version for interface: clip and insert in a temp buffer.
z : if the hotspot is bottom z is the position of the line of the string, not the bottom of the string bounding box !
Implements NL3D::UTextContext.
Definition at line 267 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::printClipAt().
Referenced by printClipAtOld().
| void NL3D::CTextContextUser::printClipAtOld | ( | float | x, | |
| float | y, | |||
| uint32 | i, | |||
| float | xmin, | |||
| float | ymin, | |||
| float | xmax, | |||
| float | ymax | |||
| ) | [virtual] |
Implements NL3D::UTextContext.
Definition at line 281 of file text_context_user.cpp.
References flushRenderBuffer(), and printClipAt().
| void NL3D::CTextContextUser::printClipAtUnProjected | ( | URenderStringBuffer & | renderBuffer, | |
| class NL3D::CFrustum & | frustum, | |||
| const NLMISC::CMatrix & | worldSpaceMatrix, | |||
| float | x, | |||
| float | y, | |||
| float | depth, | |||
| uint32 | i, | |||
| float | xmin, | |||
| float | ymin, | |||
| float | xmax, | |||
| float | ymax | |||
| ) | [virtual] |
Same as printClipAt but special version for planar 3d interface: the final vertices are unproject using a frustum.
depth is the positive depth to used to unproject the string worldSpaceMatrix is used to mul each vertex (when in 0..1 coordinate for x/y and in meter for z coordinate)
Implements NL3D::UTextContext.
Definition at line 274 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::printClipAtUnProjected().
compute and print a string at the location (2D method) x/y E [0,1]
Implements NL3D::UTextContext.
Definition at line 294 of file text_context_user.cpp.
References _DriverUser, _TextContext, H_AUTO2, NLMISC::MaxCStringSize, NLMISC_CONVERT_VARGS, NL3D::CTextContext::printAt(), and NL3D::CDriverUser::restoreMatrixContext().
| void NL3D::CTextContextUser::render3D | ( | const CMatrix & | mat, | |
| const char * | format, | |||
| ... | ||||
| ) | [virtual] |
compute and render a string at the location (3D method) render3D() use UDriver Matrix context for Frustum/ViewMatrix, but use its own modelmatrix (mat).
Implements NL3D::UTextContext.
Definition at line 316 of file text_context_user.cpp.
References _DriverUser, NLMISC::MaxCStringSize, NL3D_HAUTO_RENDER_3D_TEXTCONTEXT, NLMISC_CONVERT_VARGS, render3D(), and NL3D::CDriverUser::restoreMatrixContext().
compute and render a ucstring at the location (3D method) render3D() use UDriver Matrix context for Frustum/ViewMatrix, but use its own modelmatrix (mat).
Implements NL3D::UTextContext.
Definition at line 305 of file text_context_user.cpp.
References _Driver, _DriverUser, _TextContext, NL3D::CTextContext::computeString(), NL3D_HAUTO_RENDER_3D_TEXTCONTEXT, NL3D::CComputedString::render3D(), and NL3D::CDriverUser::restoreMatrixContext().
Referenced by render3D().
| void NL3D::CTextContextUser::resetStringSelection | ( | uint32 | i | ) | [virtual] |
reset the letter selection of a string to 0/0xFFFFFFFF (all displayed)
Implements NL3D::UTextContext.
Definition at line 222 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getComputedString(), NL3D::CComputedString::SelectSize, and NL3D::CComputedString::SelectStart.
| void NL3D::CTextContextUser::setColor | ( | NLMISC::CRGBA | color | ) | [virtual] |
set the font color
| color | the font color |
Implements NL3D::UTextContext.
Definition at line 92 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setColor().
| void NL3D::CTextContextUser::setFontSize | ( | uint32 | fontSize | ) | [virtual] |
set the font size.
Should be called before the first print
| fonSize | the font size |
Implements NL3D::UTextContext.
Definition at line 98 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setFontSize().
| void NL3D::CTextContextUser::setHotSpot | ( | THotSpot | hotSpot | ) | [virtual] |
set the hot spot
| fonSize | the font size |
Implements NL3D::UTextContext.
Definition at line 110 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setHotSpot().
| void NL3D::CTextContextUser::setKeep800x600Ratio | ( | bool | keep | ) | [virtual] |
set to true if you want that the font manager look at Driver window size, and resize fontSize so it keeps same size than if it was in 800x600.
..
Implements NL3D::UTextContext.
Definition at line 176 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setKeep800x600Ratio().
| void NL3D::CTextContextUser::setLetterColors | ( | ULetterColors * | letterColors, | |
| uint | index | |||
| ) | [virtual] |
colors in single line mode.
In single line mode you can assign several color to letters
Implements NL3D::UTextContext.
Definition at line 382 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setLetterColors().
| void NL3D::CTextContextUser::setScaleX | ( | float | scaleX | ) | [virtual] |
set the X scale
| scaleX | the X scale |
Implements NL3D::UTextContext.
Definition at line 122 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setScaleX().
| void NL3D::CTextContextUser::setScaleY | ( | float | scaleY | ) | [virtual] |
set the Y scale
| scaleY | the Y scale |
Implements NL3D::UTextContext.
Definition at line 128 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setScaleZ().
| void NL3D::CTextContextUser::setShadeColor | ( | NLMISC::CRGBA | sc | ) | [virtual] |
set the shadow's color The alpha of the shade is multiplied at each draw with the alpha of the color.
Default: (0,0,0,255)
| the | shadow color |
Implements NL3D::UTextContext.
Definition at line 164 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setShadeColor().
| void NL3D::CTextContextUser::setShaded | ( | bool | b | ) | [virtual] |
set the shade states
| the | shade state |
Implements NL3D::UTextContext.
Definition at line 146 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setShaded().
| void NL3D::CTextContextUser::setShadeExtent | ( | float | shext | ) | [virtual] |
set the shadow's size
| the | shade extent |
Implements NL3D::UTextContext.
Definition at line 158 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::setShadeExtent().
set the color of a string.
Implements NL3D::UTextContext.
Definition at line 205 of file text_context_user.cpp.
References _TextContext, NL3D::CComputedString::Color, and NL3D::CTextContext::getComputedString().
| void NL3D::CTextContextUser::setStringSelection | ( | uint32 | i, | |
| uint32 | selectStart, | |||
| uint32 | selectSize | |||
| ) | [virtual] |
set the letter selection of a string.
Only letters in the range given are displayed. Default is 0/0xFFFFFFFF
Implements NL3D::UTextContext.
Definition at line 213 of file text_context_user.cpp.
References _TextContext, NL3D::CTextContext::getComputedString(), NL3D::CComputedString::SelectSize, and NL3D::CComputedString::SelectStart.
computes an ucstring and adds the result to the stack
| an | ucstring |
Implements NL3D::UTextContext.
Definition at line 199 of file text_context_user.cpp.
References _TextContext, H_AUTO2, and NL3D::CTextContext::textPush().
| uint32 NL3D::CTextContextUser::textPush | ( | const char * | format, | |
| ... | ||||
| ) | [virtual] |
All rendering are done in current UDriver matrix context.
So verify your 2D/3D modes.
Implements NL3D::UTextContext.
Definition at line 190 of file text_context_user.cpp.
References _TextContext, H_AUTO2, NLMISC::MaxCStringSize, NLMISC_CONVERT_VARGS, and NL3D::CTextContext::textPush().
Definition at line 49 of file text_context_user.h.
Referenced by getStringInfo().
IDriver* NL3D::CTextContextUser::_Driver [private] |
Definition at line 48 of file text_context_user.h.
Referenced by CTextContextUser(), flushRenderBuffer(), flushRenderBufferUnProjected(), and render3D().
CDriverUser* NL3D::CTextContextUser::_DriverUser [private] |
Definition at line 47 of file text_context_user.h.
Referenced by CTextContextUser(), flushRenderBuffer(), printAt(), printfAt(), and render3D().
Definition at line 46 of file text_context_user.h.
Referenced by clear(), CTextContextUser(), dumpCacheTexture(), erase(), flushRenderBuffer(), flushRenderBufferUnProjected(), getFontSize(), getHotSpot(), getKeep800x600Ratio(), getScaleX(), getScaleY(), getShadeColor(), getShaded(), getStringInfo(), getTextContext(), isSameLetterColors(), printAt(), printClipAt(), printClipAtUnProjected(), printfAt(), render3D(), resetStringSelection(), setColor(), setFontSize(), setHotSpot(), setKeep800x600Ratio(), setLetterColors(), setScaleX(), setScaleY(), setShadeColor(), setShaded(), setShadeExtent(), setStringColor(), setStringSelection(), and textPush().
1.6.1