NL3D::CTextContextUser Class Reference

#include <text_context_user.h>

Inheritance diagram for NL3D::CTextContextUser:

NL3D::UTextContext

Detailed Description

UTextContext implementation.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 46 of file text_context_user.h.

Public Types

enum  THotSpot {
  BottomLeft = 0, MiddleLeft, TopLeft, MiddleBottom,
  MiddleMiddle, MiddleTop, BottomRight, MiddleRight,
  TopRight, HotSpotCount
}

Public Member Functions

virtual URenderStringBuffercreateRenderBuffer ()
 create a renderBuffer for printClipAt(). Must delete it with deleteRenderBuffer()

 CTextContextUser (const std::string fontFileName, const std::string fontExFileName, CDriverUser *drv, CFontManager *fmg)
 Constructor.

virtual void deleteRenderBuffer (URenderStringBuffer *buffer)
void dumpCacheTexture (const char *filename)
 Used for debug.

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.

CTextContextgetTextContext ()
virtual ~CTextContextUser ()
Rendering.
void clear ()
void erase (uint32 i)
float getLastXBound () const
virtual CStringInfo getStringInfo (const ucstring &ucstr)
virtual CStringInfo getStringInfo (uint32 i)
void printAt (float x, float y, const ucstring &ucstr)
void printAt (float x, float y, uint32 i)
void printClipAt (URenderStringBuffer &renderBuffer, float x, float y, uint32 i, float xmin, float ymin, float xmax, float ymax)
void printClipAtOld (float x, float y, uint32 i, float xmin, float ymin, float xmax, float ymax)
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)
void printfAt (float x, float y, const char *format,...)
void render3D (const CMatrix &mat, const char *format,...)
void render3D (const CMatrix &mat, const ucstring &ucstr)
void resetStringSelection (uint32 i)
void setStringColor (uint32 i, CRGBA newCol)
void setStringSelection (uint32 i, uint32 selectStart, uint32 selectSize)
uint32 textPush (const ucstring &str)
uint32 textPush (const char *format,...)
Text look.
uint32 getFontSize () const
THotSpot getHotSpot () const
bool getKeep800x600Ratio () const
float getScaleX () const
float getScaleY () const
NLMISC::CRGBA getShadeColor () const
bool getShaded () const
void setColor (NLMISC::CRGBA color)
void setFontSize (uint32 fontSize)
void setHotSpot (THotSpot hotSpot)
void setKeep800x600Ratio (bool keep)
void setScaleX (float scaleX)
void setScaleY (float scaleY)
void setShadeColor (NLMISC::CRGBA sc)
void setShaded (bool b)
void setShadeExtent (float shext)
Rendering.
virtual void render3D (const NLMISC::CMatrix &mat, const char *format,...)=0
virtual void render3D (const NLMISC::CMatrix &mat, const ucstring &ucstr)=0

Private Attributes

CComputedString _CacheString
IDriver_Driver
CDriverUser_DriverUser
CTextContext _TextContext


Member Enumeration Documentation

enum NL3D::UTextContext::THotSpot [inherited]
 

Enumeration values:
BottomLeft 
MiddleLeft 
TopLeft 
MiddleBottom 
MiddleMiddle 
MiddleTop 
BottomRight 
MiddleRight 
TopRight 
HotSpotCount 

Definition at line 70 of file u_text_context.h.

00071         {
00072                 BottomLeft=0,
00073                 MiddleLeft, 
00074                 TopLeft,
00075                 MiddleBottom, 
00076                 MiddleMiddle, 
00077                 MiddleTop, 
00078                 BottomRight, 
00079                 MiddleRight,
00080                 TopRight,
00081 
00082                 HotSpotCount
00083         };


Constructor & Destructor Documentation

NL3D::CTextContextUser::CTextContextUser const std::string  fontFileName,
const std::string  fontExFileName,
CDriverUser drv,
CFontManager fmg
[inline]
 

Constructor.

Definition at line 57 of file text_context_user.h.

References _TextContext, NL3D::CTextContext::init(), NL3D_MEM_TEXT_CONTEXT, nlassert, NL3D::CTextContext::setFontGenerator(), and uint.

00058         {
00059                 NL3D_MEM_TEXT_CONTEXT
00060                 nlassert(drv);
00061                 _DriverUser= drv;
00062 
00063                 // The enum of CComputedString and UTextContext MUST be the same!!!
00064                 nlassert((uint)UTextContext::HotSpotCount== (uint)CComputedString::HotSpotCount);
00065 
00066                 _Driver= drv->getDriver();
00067                 _TextContext.init(_Driver, fmg);
00068                 _TextContext.setFontGenerator(fontFileName, fontExFileName);
00069         }

virtual NL3D::CTextContextUser::~CTextContextUser  )  [inline, virtual]
 

Definition at line 70 of file text_context_user.h.

References NL3D_MEM_TEXT_CONTEXT.

00071         {
00072                 NL3D_MEM_TEXT_CONTEXT
00073         }


Member Function Documentation

void NL3D::CTextContextUser::clear  )  [virtual]
 

empty the map

Implements NL3D::UTextContext.

Definition at line 287 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::clear(), and NL3D_HAUTO_RENDER_2D_TEXTCONTEXT.

00288 {
00289         NL_ALLOC_CONTEXT( 3dTCClr )
00290         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00291 
00292         _TextContext.clear();
00293 }

URenderStringBuffer * NL3D::CTextContextUser::createRenderBuffer  )  [virtual]
 

create a renderBuffer for printClipAt(). Must delete it with deleteRenderBuffer()

Implements NL3D::UTextContext.

Definition at line 388 of file text_context_user.cpp.

00389 {
00390         NL_ALLOC_CONTEXT( 3dTCBuf )
00391         return new CRenderStringBuffer;
00392 }

void NL3D::CTextContextUser::deleteRenderBuffer URenderStringBuffer buffer  )  [virtual]
 

Implements NL3D::UTextContext.

Definition at line 393 of file text_context_user.cpp.

References buffer.

00394 {
00395         NL_ALLOC_CONTEXT( 3dTCBuf )
00396         delete buffer;
00397 }

void NL3D::CTextContextUser::dumpCacheTexture const char *  filename  )  [virtual]
 

Used for debug.

Implements NL3D::UTextContext.

Definition at line 380 of file text_context_user.cpp.

References _TextContext, and NL3D::CTextContext::dumpCache().

00381 {
00382         NL_ALLOC_CONTEXT( 3dTCDup )
00383         _TextContext.dumpCache (filename);
00384 }

void NL3D::CTextContextUser::erase uint32  i  )  [virtual]
 

remove a string from the list

Implements NL3D::UTextContext.

Definition at line 261 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::erase(), NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, and uint32.

00262 {
00263         NL_ALLOC_CONTEXT( 3dTCErs )
00264         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00265 
00266         _TextContext.erase(i);
00267 }

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 398 of file text_context_user.cpp.

References _TextContext, buffer, NL3D::CRenderStringBuffer::flush(), NL3D::CTextContext::getFontManager(), NL3D::CFontManager::getFontMaterial(), nlassert, NL3D::CRenderStringBuffer::NumQuads, and NL3D::CDriverUser::restoreMatrixContextMatrixOnly().

Referenced by printClipAtOld().

00399 {
00400         NL_ALLOC_CONTEXT( 3dTCBuf )
00401                 nlassert(buffer);
00402         CRenderStringBuffer     *rdrBuffer= static_cast<CRenderStringBuffer*>(buffer);
00403         if(rdrBuffer->NumQuads)
00404         {
00405                 rdrBuffer->flush(*_Driver, _TextContext.getFontManager()->getFontMaterial());
00406                 
00407                 // must restore the Matrix context if some display done. Need just for Frustum/Matrixes
00408                 _DriverUser->restoreMatrixContextMatrixOnly();
00409         }
00410 }

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 411 of file text_context_user.cpp.

References _TextContext, buffer, NL3D::CRenderStringBuffer::flushUnProjected(), NL3D::CTextContext::getFontManager(), NL3D::CFontManager::getFontMaterial(), nlassert, and NL3D::CRenderStringBuffer::NumQuads.

00412 {
00413         NL_ALLOC_CONTEXT( 3dTCBuf )
00414                 nlassert(buffer);
00415         CRenderStringBuffer     *rdrBuffer= static_cast<CRenderStringBuffer*>(buffer);
00416         if(rdrBuffer->NumQuads)
00417         {
00418                 rdrBuffer->flushUnProjected(*_Driver, _TextContext.getFontManager()->getFontMaterial(), zwrite);
00419         }
00420 }

uint32 NL3D::CTextContextUser::getFontSize  )  const [virtual]
 

get the font size

Returns:
the font size

Implements NL3D::UTextContext.

Definition at line 115 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getFontSize(), NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and uint32.

00116 {
00117         NL3D_MEM_TEXT_CONTEXT
00118         NL3D_HAUTO_UI_TEXTCONTEXT;
00119 
00120         return _TextContext.getFontSize();
00121 }

UTextContext::THotSpot NL3D::CTextContextUser::getHotSpot  )  const [virtual]
 

get the hot spot

Returns:
the hot spot

Implements NL3D::UTextContext.

Definition at line 129 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getHotSpot(), NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and uint32.

00130 {
00131         NL3D_MEM_TEXT_CONTEXT
00132         NL3D_HAUTO_UI_TEXTCONTEXT;
00133 
00134         return (THotSpot)(uint32)_TextContext.getHotSpot();
00135 }

bool NL3D::CTextContextUser::getKeep800x600Ratio  )  const [virtual]
 

return keep800x600Ratio state.

Implements NL3D::UTextContext.

Definition at line 206 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getKeep800x600Ratio(), NL3D_HAUTO_UI_TEXTCONTEXT, and NL3D_MEM_TEXT_CONTEXT.

00207 {
00208         NL3D_MEM_TEXT_CONTEXT
00209         NL3D_HAUTO_UI_TEXTCONTEXT;
00210 
00211         return _TextContext.getKeep800x600Ratio();
00212 }

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).

Returns:
x coordinate

Implements NL3D::UTextContext.

Definition at line 371 of file text_context_user.cpp.

References NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, and NL3D_MEM_TEXT_CONTEXT.

00372 {
00373         NL3D_MEM_TEXT_CONTEXT
00374         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00375 
00376         return 0.0f;
00377 }

float NL3D::CTextContextUser::getScaleX  )  const [virtual]
 

Returns:
the X scale

Implements NL3D::UTextContext.

Definition at line 150 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getScaleX(), NL3D_HAUTO_UI_TEXTCONTEXT, and NL3D_MEM_TEXT_CONTEXT.

00151 {
00152         NL3D_MEM_TEXT_CONTEXT
00153         NL3D_HAUTO_UI_TEXTCONTEXT;
00154 
00155         return _TextContext.getScaleX();
00156 }

float NL3D::CTextContextUser::getScaleY  )  const [virtual]
 

Returns:
the Y scale

Implements NL3D::UTextContext.

Definition at line 157 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getScaleZ(), NL3D_HAUTO_UI_TEXTCONTEXT, and NL3D_MEM_TEXT_CONTEXT.

00158 {
00159         NL3D_MEM_TEXT_CONTEXT
00160         NL3D_HAUTO_UI_TEXTCONTEXT;
00161 
00162         return _TextContext.getScaleZ();
00163 }

NLMISC::CRGBA NL3D::CTextContextUser::getShadeColor  )  const [virtual]
 

get the shadow's color the shadow color

Implements NL3D::UTextContext.

Definition at line 192 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getShadeColor(), NL3D_HAUTO_UI_TEXTCONTEXT, and NL3D_MEM_TEXT_CONTEXT.

00193 {
00194         NL3D_MEM_TEXT_CONTEXT
00195         NL3D_HAUTO_UI_TEXTCONTEXT;
00196 
00197         return _TextContext.getShadeColor();
00198 }

bool NL3D::CTextContextUser::getShaded  )  const [virtual]
 

Returns:
the shade state

Implements NL3D::UTextContext.

Definition at line 171 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getShaded(), NL3D_HAUTO_UI_TEXTCONTEXT, and NL3D_MEM_TEXT_CONTEXT.

00172 {
00173         NL3D_MEM_TEXT_CONTEXT
00174         NL3D_HAUTO_UI_TEXTCONTEXT;
00175 
00176         return _TextContext.getShaded();
00177 }

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 279 of file text_context_user.cpp.

References _CacheString, _TextContext, NL3D::CTextContext::computeStringInfo(), NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NL3D::CComputedString::StringHeight, NL3D::CComputedString::StringLine, and NL3D::CComputedString::StringWidth.

00280 {
00281         NL_ALLOC_CONTEXT( 3dTCIfo )
00282         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00283 
00284         _TextContext.computeStringInfo(str, _CacheString);
00285         return CStringInfo (_CacheString.StringWidth, _CacheString.StringHeight, _CacheString.StringLine);
00286 }

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 268 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getComputedString(), NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NL3D::CComputedString::StringHeight, NL3D::CComputedString::StringLine, NL3D::CComputedString::StringWidth, and uint32.

00269 {
00270         NL_ALLOC_CONTEXT( 3dTCIfo )
00271         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00272 
00273         CComputedString         *cstr= _TextContext.getComputedString(i);
00274         if(!cstr)
00275                 return CStringInfo(0, 0, 0);
00276         else
00277                 return  CStringInfo(cstr->StringWidth, cstr->StringHeight, cstr->StringLine);
00278 }

CTextContext& NL3D::CTextContextUser::getTextContext  )  [inline]
 

Definition at line 133 of file text_context_user.h.

References _TextContext.

00133 {return _TextContext;}

void NL3D::CTextContextUser::printAt float  x,
float  y,
const ucstring ucstr
[virtual]
 

compute and print a ucstring at the location (2D method) x/y E [0,1]

Implements NL3D::UTextContext.

Definition at line 325 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NL3D::CTextContext::printAt(), NL3D::CDriverUser::restoreMatrixContext(), x, and y.

00326 {
00327         NL_ALLOC_CONTEXT( 3dTCPt3 )
00328         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00329 
00330         _TextContext.printAt(x, y, ucstr);
00331         _DriverUser->restoreMatrixContext();
00332 }

void NL3D::CTextContextUser::printAt float  x,
float  y,
uint32  i
[virtual]
 

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 294 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NL3D::CTextContext::printAt(), NL3D::CDriverUser::restoreMatrixContext(), uint32, x, and y.

00295 {
00296         NL_ALLOC_CONTEXT( 3dTCPt0 )
00297         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00298 
00299         _TextContext.printAt(x, y, i);
00300         _DriverUser->restoreMatrixContext();
00301 }

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 302 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NL3D::CTextContext::printClipAt(), uint32, x, and y.

Referenced by printClipAtOld().

00303 {
00304         NL_ALLOC_CONTEXT( 3dTCPt1 )
00305         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00306 
00307         _TextContext.printClipAt(static_cast<CRenderStringBuffer&>(renderBuffer), x, y, i, xmin, ymin, xmax, ymax);
00308         // Don't need to restore Matrix context here since no driver change
00309 }

void NL3D::CTextContextUser::printClipAtOld float  x,
float  y,
uint32  i,
float  xmin,
float  ymin,
float  xmax,
float  ymax
[virtual]
 

empty the map

Implements NL3D::UTextContext.

Definition at line 318 of file text_context_user.cpp.

References flushRenderBuffer(), printClipAt(), uint32, x, and y.

00319 {
00320         NL_ALLOC_CONTEXT( 3dTCPt2 )
00321         static  CRenderStringBuffer     rdrBuffer;
00322         printClipAt(rdrBuffer, x, y ,i, xmin, ymin, xmax, ymax);
00323         flushRenderBuffer(&rdrBuffer);
00324 }

void NL3D::CTextContextUser::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
[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 310 of file text_context_user.cpp.

References _TextContext, depth, NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NL3D::CTextContext::printClipAtUnProjected(), uint32, x, and y.

00311 {
00312         NL_ALLOC_CONTEXT( 3dTCPt1 )
00313                 NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00314         
00315         _TextContext.printClipAtUnProjected(static_cast<CRenderStringBuffer&>(renderBuffer), frustum, scaleMatrix, x, y, depth, i, xmin, ymin, xmax, ymax);
00316         // Don't need to restore Matrix context here since no driver change
00317 }

void NL3D::CTextContextUser::printfAt float  x,
float  y,
const char *  format,
... 
[virtual]
 

compute and print a string at the location (2D method) x/y E [0,1]

Implements NL3D::UTextContext.

Definition at line 333 of file text_context_user.cpp.

References _TextContext, format, NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NLMISC_CONVERT_VARGS, NL3D::CTextContext::printAt(), NL3D::CDriverUser::restoreMatrixContext(), x, and y.

00334 {
00335         NL_ALLOC_CONTEXT( 3dTCPt4 )
00336         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00337 
00338         char *str;
00339         NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize);
00340 
00341         _TextContext.printAt(x, y, ucstring(str)) ;
00342         _DriverUser->restoreMatrixContext();
00343 }

virtual void NL3D::UTextContext::render3D const NLMISC::CMatrix mat,
const char *  format,
... 
[pure virtual, inherited]
 

compute and render a string at the location (3D method) render3D() use UDriver Matrix context for Frustum/ViewMatrix, but use its own modelmatrix (mat).

virtual void NL3D::UTextContext::render3D const NLMISC::CMatrix mat,
const ucstring ucstr
[pure virtual, inherited]
 

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 NL3D::CTextContextUser::render3D const CMatrix mat,
const char *  format,
... 
 

Definition at line 357 of file text_context_user.cpp.

References format, NL3D_HAUTO_RENDER_3D_TEXTCONTEXT, NLMISC_CONVERT_VARGS, render3D(), and NL3D::CDriverUser::restoreMatrixContext().

00358 {
00359         NL_ALLOC_CONTEXT( 3dTCRd1 )
00360         NL3D_HAUTO_RENDER_3D_TEXTCONTEXT;
00361 
00362         char *str;
00363         NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize);
00364 
00365         render3D(mat, ucstring(str));
00366 
00367         _DriverUser->restoreMatrixContext();
00368 }

void NL3D::CTextContextUser::render3D const CMatrix mat,
const ucstring ucstr
 

Definition at line 345 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::computeString(), NL3D_HAUTO_RENDER_3D_TEXTCONTEXT, NL3D::CComputedString::render3D(), and NL3D::CDriverUser::restoreMatrixContext().

Referenced by render3D().

00346 {
00347         NL_ALLOC_CONTEXT( 3dTCRd0 )
00348         NL3D_HAUTO_RENDER_3D_TEXTCONTEXT;
00349 
00350         CComputedString computedStr;
00351         _TextContext.computeString(ucstr,computedStr);
00352         
00353         computedStr.render3D(*_Driver,mat);
00354 
00355         _DriverUser->restoreMatrixContext();
00356 }

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 251 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getComputedString(), NL3D_MEM_TEXT_CONTEXT, and uint32.

00252 {
00253         NL3D_MEM_TEXT_CONTEXT
00254         CComputedString *str= _TextContext.getComputedString(i);
00255         if(str)
00256         {
00257                 str->SelectStart= 0;
00258                 str->SelectSize= ~0;
00259         }
00260 }

void NL3D::CTextContextUser::setColor NLMISC::CRGBA  color  )  [virtual]
 

set the font color

Parameters:
color the font color

Implements NL3D::UTextContext.

Definition at line 101 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and NL3D::CTextContext::setColor().

00102 {
00103         NL3D_MEM_TEXT_CONTEXT
00104         NL3D_HAUTO_UI_TEXTCONTEXT;
00105 
00106         _TextContext.setColor(color);
00107 }

void NL3D::CTextContextUser::setFontSize uint32  fontSize  )  [virtual]
 

set the font size. Should be called before the first print

Parameters:
fonSize the font size

Implements NL3D::UTextContext.

Definition at line 108 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, NL3D::CTextContext::setFontSize(), and uint32.

00109 {
00110         NL3D_MEM_TEXT_CONTEXT
00111         NL3D_HAUTO_UI_TEXTCONTEXT;
00112 
00113         _TextContext.setFontSize(fontSize);
00114 }

void NL3D::CTextContextUser::setHotSpot THotSpot  hotSpot  )  [virtual]
 

set the hot spot

Parameters:
fonSize the font size

Implements NL3D::UTextContext.

Definition at line 122 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, NL3D::CTextContext::setHotSpot(), and uint32.

00123 {
00124         NL3D_MEM_TEXT_CONTEXT
00125         NL3D_HAUTO_UI_TEXTCONTEXT;
00126 
00127         _TextContext.setHotSpot((CComputedString::THotSpot)(uint32)hotSpot) ;
00128 }

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 199 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and NL3D::CTextContext::setKeep800x600Ratio().

00200 {
00201         NL3D_MEM_TEXT_CONTEXT
00202         NL3D_HAUTO_UI_TEXTCONTEXT;
00203 
00204         _TextContext.setKeep800x600Ratio(keep);
00205 }

void NL3D::CTextContextUser::setScaleX float  scaleX  )  [virtual]
 

set the X scale

Parameters:
scaleX the X scale

Implements NL3D::UTextContext.

Definition at line 136 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and NL3D::CTextContext::setScaleX().

00137 {
00138         NL3D_MEM_TEXT_CONTEXT
00139         NL3D_HAUTO_UI_TEXTCONTEXT;
00140 
00141         _TextContext.setScaleX(scaleX);
00142 }

void NL3D::CTextContextUser::setScaleY float  scaleY  )  [virtual]
 

set the Y scale

Parameters:
scaleY the Y scale

Implements NL3D::UTextContext.

Definition at line 143 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and NL3D::CTextContext::setScaleZ().

00144 {
00145         NL3D_MEM_TEXT_CONTEXT
00146         NL3D_HAUTO_UI_TEXTCONTEXT;
00147 
00148         _TextContext.setScaleZ(scaleY);
00149 }

void NL3D::CTextContextUser::setShadeColor NLMISC::CRGBA  sc  )  [virtual]
 

set the shadow's color

Parameters:
the shadow color

Implements NL3D::UTextContext.

Definition at line 185 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and NL3D::CTextContext::setShadeColor().

00186 {
00187         NL3D_MEM_TEXT_CONTEXT
00188         NL3D_HAUTO_UI_TEXTCONTEXT;
00189 
00190         _TextContext.setShadeColor (sc);
00191 }

void NL3D::CTextContextUser::setShaded bool  b  )  [virtual]
 

set the shade states

Parameters:
the shade state

Implements NL3D::UTextContext.

Definition at line 164 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and NL3D::CTextContext::setShaded().

00165 {
00166         NL3D_MEM_TEXT_CONTEXT
00167         NL3D_HAUTO_UI_TEXTCONTEXT;
00168 
00169         _TextContext.setShaded(b);
00170 }

void NL3D::CTextContextUser::setShadeExtent float  shext  )  [virtual]
 

set the shadow's size

Parameters:
the shade extent

Implements NL3D::UTextContext.

Definition at line 178 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_UI_TEXTCONTEXT, NL3D_MEM_TEXT_CONTEXT, and NL3D::CTextContext::setShadeExtent().

00179 {
00180         NL3D_MEM_TEXT_CONTEXT
00181         NL3D_HAUTO_UI_TEXTCONTEXT;
00182 
00183         _TextContext.setShadeExtent(shext);
00184 }

void NL3D::CTextContextUser::setStringColor uint32  i,
CRGBA  newCol
[virtual]
 

set the color of a string.

Implements NL3D::UTextContext.

Definition at line 233 of file text_context_user.cpp.

References _TextContext, NL3D::CComputedString::Color, NL3D::CTextContext::getComputedString(), and uint32.

00234 {
00235         CComputedString *str= _TextContext.getComputedString(i);
00236         if(str)
00237         {
00238                 str->Color= newCol;
00239         }
00240 }

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 241 of file text_context_user.cpp.

References _TextContext, NL3D::CTextContext::getComputedString(), NL3D_MEM_TEXT_CONTEXT, and uint32.

00242 {
00243         NL3D_MEM_TEXT_CONTEXT
00244         CComputedString *str= _TextContext.getComputedString(i);
00245         if(str)
00246         {
00247                 str->SelectStart= selectStart;
00248                 str->SelectSize= selectSize;
00249         }
00250 }

uint32 NL3D::CTextContextUser::textPush const ucstring str  )  [virtual]
 

computes an ucstring and adds the result to the stack

Parameters:
an ucstring
Returns:
the index where computed string has been inserted

Implements NL3D::UTextContext.

Definition at line 226 of file text_context_user.cpp.

References _TextContext, NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NL3D::CTextContext::textPush(), and uint32.

00227 {
00228         NL_ALLOC_CONTEXT( 3dTCPh1 )
00229         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00230 
00231         return _TextContext.textPush(str) ;
00232 }

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 216 of file text_context_user.cpp.

References _TextContext, format, NL3D_HAUTO_RENDER_2D_TEXTCONTEXT, NLMISC_CONVERT_VARGS, NL3D::CTextContext::textPush(), and uint32.

00217 {
00218         NL_ALLOC_CONTEXT( 3dTCPh0 )
00219         NL3D_HAUTO_RENDER_2D_TEXTCONTEXT;
00220 
00221         char *str;
00222         NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize);
00223 
00224         return _TextContext.textPush(ucstring(str)) ;
00225 }


Field Documentation

CComputedString NL3D::CTextContextUser::_CacheString [private]
 

Definition at line 52 of file text_context_user.h.

Referenced by getStringInfo().

IDriver* NL3D::CTextContextUser::_Driver [private]
 

Definition at line 51 of file text_context_user.h.

CDriverUser* NL3D::CTextContextUser::_DriverUser [private]
 

Definition at line 50 of file text_context_user.h.

CTextContext NL3D::CTextContextUser::_TextContext [private]
 

Definition at line 49 of file text_context_user.h.

Referenced by clear(), CTextContextUser(), dumpCacheTexture(), erase(), flushRenderBuffer(), flushRenderBufferUnProjected(), getFontSize(), getHotSpot(), getKeep800x600Ratio(), getScaleX(), getScaleY(), getShadeColor(), getShaded(), getStringInfo(), getTextContext(), printAt(), printClipAt(), printClipAtUnProjected(), printfAt(), render3D(), resetStringSelection(), setColor(), setFontSize(), setHotSpot(), setKeep800x600Ratio(), setScaleX(), setScaleY(), setShadeColor(), setShaded(), setShadeExtent(), setStringColor(), setStringSelection(), and textPush().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:49:48 2004 for NeL by doxygen 1.3.6