# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CTextContext Class Reference

CTextContext. More...

#include <text_context.h>

List of all members.

Public Methods

 CTextContext ()
 Constructor defaults : fontsize=12, color=black, hotspot=bottomleft, scale=1, shaded=false, 800x600ratio=true. More...

 ~CTextContext ()
 Destructor. More...

void init (IDriver *drv, CFontManager *fmg)
 set the driver. More...

void setFontGenerator (const std::string fontFileName, const std::string fontExFileName="")
 Must be called before any print. More...

NL3D::CFontGeneratorgetFontGenerator ()
void setColor (NLMISC::CRGBA color)
 Accessors SET. More...

void setFontSize (uint32 fontSize)
void setHotSpot (CComputedString::THotSpot hotSpot)
void setScaleX (float scaleX)
void setScaleZ (float scaleZ)
void setShaded (bool b)
void setShadeExtent (float shext)
 Set the shadow's size. More...

void setKeep800x600Ratio (bool keep)
 If true the CFontManager look at Driver window size, and resize fontSize to keep the same size than if it was in 800x600... More...

NLMISC::CRGBA getColor () const
 Accessors GET. More...

uint32 getFontSize () const
CComputedString::THotSpot getHotSpot () const
float getScaleX () const
float getScaleZ () const
bool getShaded () const
bool getKeep800x600Ratio () const
uint32 textPush (const char *format,...)
 compute and add a string to the cache (return the index). More...

uint32 textPush (const ucstring &str)
 computes an ucstring and adds the result to the cache (return the index). More...

void erase (uint32 index)
 remove a string from the cache. More...

void clear ()
 Clear the cache. More...

void printAt (float x, float z, uint32 index)
 Print a string that is in the cache from its index (it leaves the string in the cache). More...

void printClipAt (float x, float z, uint32 index, float xmin, float ymin, float xmax, float ymax)
 Clip and print a string that is in the cache (it leaves the string in the cache). More...

void printAt (float x, float z, const ucstring &ucstr)
 Directly print a string. More...

void printfAt (float x, float z, const char *format,...)
 Directly print a string. More...

CComputedStringoperator[] (uint32 index)
 Get computed string from index. More...

CComputedStringgetComputedString (uint32 index)
void computeString (const std::string &s, CComputedString &output)
 Compute a string as primitive blocks using the font manager's method computeString. More...

void computeString (const ucstring &s, CComputedString &output)
 Compute a ucstring as primitive blocks using the font manager's method computeString. More...

void computeStringInfo (const ucstring &s, CComputedString &output)
void dumpCache (const char *filename)
 Debug : write to the disk the texture cache. More...


Private Attributes

IDriver_Driver
 Driver. More...

NL3D::CFontManager_FontManager
 Font manager. More...

NL3D::CFontGenerator_FontGen
 Font generator. More...

uint32 _FontSize
 Font size;. More...

NLMISC::CRGBA _Color
 Current text color. More...

CComputedString::THotSpot _HotSpot
 Hotspot. More...

float _ScaleX
 X scale. More...

float _ScaleZ
 Z scale. More...

bool _Shaded
 true if text is shaded. More...

float _ShadeExtent
 shade's extent. More...

bool _Keep800x600Ratio
 resize the font to keep the same aspect ratio than in 800x600. More...

std::vector< CComputedString_CacheStrings
 Cache to manipulate strings with indexes. More...

std::vector< uint32_CacheFreePlaces
uint32 _CacheNbFreePlaces
CComputedString _TempString
 Cache for for printAt() and printfAt(). This prevents from creating VBdrvinfos each time they are called (N*each frame!!). More...

CComputedString _TempShadowString


Detailed Description

CTextContext.

Author:
Stephane Coutelas , Nevrax France
Date:
2000

Definition at line 44 of file text_context.h.


Constructor & Destructor Documentation

NL3D::CTextContext::CTextContext  
 

Constructor defaults : fontsize=12, color=black, hotspot=bottomleft, scale=1, shaded=false, 800x600ratio=true.

Definition at line 36 of file text_context.cpp.

References _CacheNbFreePlaces, _Color, _Driver, _FontGen, _FontManager, _FontSize, _HotSpot, _Keep800x600Ratio, _ScaleX, _ScaleZ, _Shaded, and _ShadeExtent.

NL3D::CTextContext::~CTextContext  
 

Destructor.

Definition at line 62 of file text_context.cpp.

References _FontGen.


Member Function Documentation

void NL3D::CTextContext::clear  
 

Clear the cache.

Definition at line 140 of file text_context.cpp.

References _CacheFreePlaces, _CacheNbFreePlaces, and _CacheStrings.

void NL3D::CTextContext::computeString const ucstring   s,
CComputedString   output
[inline]
 

Compute a ucstring as primitive blocks using the font manager's method computeString.

Parameters:
an  ucstring
the  computed string

Definition at line 212 of file text_context.h.

References _Color, _Driver, _FontGen, _FontManager, _FontSize, _Keep800x600Ratio, NL3D::CFontManager::computeString, and s.

void NL3D::CTextContext::computeString const std::string &    s,
CComputedString   output
[inline]
 

Compute a string as primitive blocks using the font manager's method computeString.

Parameters:
a  string
the  computed string

Definition at line 201 of file text_context.h.

References _Color, _Driver, _FontGen, _FontManager, _FontSize, _Keep800x600Ratio, NL3D::CFontManager::computeString, and s.

void NL3D::CTextContext::computeStringInfo const ucstring   s,
CComputedString   output
[inline]
 

Definition at line 217 of file text_context.h.

References _Color, _Driver, _FontGen, _FontManager, _FontSize, _Keep800x600Ratio, NL3D::CFontManager::computeStringInfo, and s.

void NL3D::CTextContext::dumpCache const char *    filename [inline]
 

Debug : write to the disk the texture cache.

Definition at line 223 of file text_context.h.

References _FontManager, and NL3D::CFontManager::dumpCache.

void NL3D::CTextContext::erase uint32    index
 

remove a string from the cache.

Definition at line 125 of file text_context.cpp.

References _CacheFreePlaces, and _CacheNbFreePlaces.

NLMISC::CRGBA NL3D::CTextContext::getColor void    const [inline]
 

Accessors GET.

Definition at line 98 of file text_context.h.

References _Color.

CComputedString* NL3D::CTextContext::getComputedString uint32    index [inline]
 

Definition at line 186 of file text_context.h.

References _CacheStrings, and index.

NL3D::CFontGenerator* NL3D::CTextContext::getFontGenerator void    [inline]
 

Definition at line 69 of file text_context.h.

References _FontGen.

uint32 NL3D::CTextContext::getFontSize   const [inline]
 

Definition at line 100 of file text_context.h.

References _FontSize.

CComputedString::THotSpot NL3D::CTextContext::getHotSpot   const [inline]
 

Definition at line 102 of file text_context.h.

References _HotSpot.

bool NL3D::CTextContext::getKeep800x600Ratio   const [inline]
 

Definition at line 110 of file text_context.h.

References _Keep800x600Ratio.

float NL3D::CTextContext::getScaleX   const [inline]
 

Definition at line 104 of file text_context.h.

References _ScaleX.

float NL3D::CTextContext::getScaleZ   const [inline]
 

Definition at line 106 of file text_context.h.

References _ScaleZ.

bool NL3D::CTextContext::getShaded   const [inline]
 

Definition at line 108 of file text_context.h.

References _Shaded.

void NL3D::CTextContext::init IDriver   drv,
CFontManager   fmg
[inline]
 

set the driver.

Definition at line 60 of file text_context.h.

References _Driver, _FontManager, and nlassert.

CComputedString& NL3D::CTextContext::operator[] uint32    index [inline]
 

Get computed string from index.

Definition at line 180 of file text_context.h.

References _CacheStrings, index, and nlassert.

void NL3D::CTextContext::printAt float    x,
float    z,
const ucstring   ucstr
[inline]
 

Directly print a string.

Definition at line 149 of file text_context.h.

References _Color, _Driver, _FontGen, _FontManager, _FontSize, _HotSpot, _Keep800x600Ratio, _ScaleX, _ScaleZ, _ShadeExtent, _TempShadowString, _TempString, NL3D::CFontManager::computeString, x, and z.

void NL3D::CTextContext::printAt float    x,
float    z,
uint32    index
[inline]
 

Print a string that is in the cache from its index (it leaves the string in the cache).

Definition at line 133 of file text_context.h.

References _CacheStrings, _Driver, _HotSpot, _ScaleX, _ScaleZ, index, nlassert, x, and z.

void NL3D::CTextContext::printClipAt float    x,
float    z,
uint32    index,
float    xmin,
float    ymin,
float    xmax,
float    ymax
[inline]
 

Clip and print a string that is in the cache (it leaves the string in the cache).

Definition at line 141 of file text_context.h.

References _CacheStrings, _Driver, index, nlassert, x, and z.

void NL3D::CTextContext::printfAt float    x,
float    z,
const char *    format,
...   
[inline]
 

Directly print a string.

Definition at line 162 of file text_context.h.

References _Color, _Driver, _FontGen, _FontManager, _FontSize, _HotSpot, _Keep800x600Ratio, _ScaleX, _ScaleZ, _ShadeExtent, _TempShadowString, _TempString, NL3D::CFontManager::computeString, format, nlassert, NLMISC_CONVERT_VARGS, x, and z.

void NL3D::CTextContext::setColor NLMISC::CRGBA    color [inline]
 

Accessors SET.

Definition at line 75 of file text_context.h.

References _Color.

void NL3D::CTextContext::setFontGenerator const std::string    fontFileName,
const std::string    fontExFileName = ""
 

Must be called before any print.

Definition at line 149 of file text_context.cpp.

References _FontGen.

void NL3D::CTextContext::setFontSize uint32    fontSize [inline]
 

Definition at line 77 of file text_context.h.

References _FontSize.

void NL3D::CTextContext::setHotSpot CComputedString::THotSpot    hotSpot [inline]
 

Definition at line 79 of file text_context.h.

References _HotSpot.

void NL3D::CTextContext::setKeep800x600Ratio bool    keep [inline]
 

If true the CFontManager look at Driver window size, and resize fontSize to keep the same size than if it was in 800x600...

Definition at line 92 of file text_context.h.

References _Keep800x600Ratio.

void NL3D::CTextContext::setScaleX float    scaleX [inline]
 

Definition at line 81 of file text_context.h.

References _ScaleX.

void NL3D::CTextContext::setScaleZ float    scaleZ [inline]
 

Definition at line 83 of file text_context.h.

References _ScaleZ.

void NL3D::CTextContext::setShaded bool    b [inline]
 

Definition at line 85 of file text_context.h.

References _Shaded.

void NL3D::CTextContext::setShadeExtent float    shext [inline]
 

Set the shadow's size.

Definition at line 88 of file text_context.h.

References _ShadeExtent.

uint32 NL3D::CTextContext::textPush const ucstring   str
 

computes an ucstring and adds the result to the cache (return the index).

Definition at line 99 of file text_context.cpp.

References _CacheFreePlaces, _CacheNbFreePlaces, _CacheStrings, _Color, _Driver, _FontGen, _FontManager, _FontSize, _Keep800x600Ratio, NL3D::CFontManager::computeString, index, and nlassert.

uint32 NL3D::CTextContext::textPush const char *    format,
...   
 

compute and add a string to the cache (return the index).

Definition at line 69 of file text_context.cpp.

References _CacheFreePlaces, _CacheNbFreePlaces, _CacheStrings, _Color, _Driver, _FontGen, _FontManager, _FontSize, _Keep800x600Ratio, NL3D::CFontManager::computeString, format, index, nlassert, and NLMISC_CONVERT_VARGS.


Member Data Documentation

std::vector<uint32> NL3D::CTextContext::_CacheFreePlaces [private]
 

Definition at line 273 of file text_context.h.

Referenced by clear, erase, and textPush.

uint32 NL3D::CTextContext::_CacheNbFreePlaces [private]
 

Definition at line 274 of file text_context.h.

Referenced by clear, CTextContext, erase, and textPush.

std::vector<CComputedString> NL3D::CTextContext::_CacheStrings [private]
 

Cache to manipulate strings with indexes.

Definition at line 272 of file text_context.h.

Referenced by clear, getComputedString, operator[], printAt, printClipAt, and textPush.

NLMISC::CRGBA NL3D::CTextContext::_Color [private]
 

Current text color.

Definition at line 247 of file text_context.h.

Referenced by computeString, computeStringInfo, CTextContext, getColor, printAt, printfAt, setColor, and textPush.

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

Driver.

Definition at line 231 of file text_context.h.

Referenced by computeString, computeStringInfo, CTextContext, init, printAt, printClipAt, printfAt, and textPush.

NL3D::CFontGenerator* NL3D::CTextContext::_FontGen [private]
 

Font generator.

Definition at line 237 of file text_context.h.

Referenced by computeString, computeStringInfo, CTextContext, getFontGenerator, printAt, printfAt, setFontGenerator, textPush, and ~CTextContext.

NL3D::CFontManager* NL3D::CTextContext::_FontManager [private]
 

Font manager.

Definition at line 234 of file text_context.h.

Referenced by computeString, computeStringInfo, CTextContext, dumpCache, init, printAt, printfAt, and textPush.

uint32 NL3D::CTextContext::_FontSize [private]
 

Font size;.

Definition at line 244 of file text_context.h.

Referenced by computeString, computeStringInfo, CTextContext, getFontSize, printAt, printfAt, setFontSize, and textPush.

CComputedString::THotSpot NL3D::CTextContext::_HotSpot [private]
 

Hotspot.

Definition at line 250 of file text_context.h.

Referenced by CTextContext, getHotSpot, printAt, printfAt, and setHotSpot.

bool NL3D::CTextContext::_Keep800x600Ratio [private]
 

resize the font to keep the same aspect ratio than in 800x600.

Definition at line 265 of file text_context.h.

Referenced by computeString, computeStringInfo, CTextContext, getKeep800x600Ratio, printAt, printfAt, setKeep800x600Ratio, and textPush.

float NL3D::CTextContext::_ScaleX [private]
 

X scale.

Definition at line 253 of file text_context.h.

Referenced by CTextContext, getScaleX, printAt, printfAt, and setScaleX.

float NL3D::CTextContext::_ScaleZ [private]
 

Z scale.

Definition at line 256 of file text_context.h.

Referenced by CTextContext, getScaleZ, printAt, printfAt, and setScaleZ.

bool NL3D::CTextContext::_Shaded [private]
 

true if text is shaded.

Definition at line 259 of file text_context.h.

Referenced by CTextContext, getShaded, and setShaded.

float NL3D::CTextContext::_ShadeExtent [private]
 

shade's extent.

Definition at line 262 of file text_context.h.

Referenced by CTextContext, printAt, printfAt, and setShadeExtent.

CComputedString NL3D::CTextContext::_TempShadowString [private]
 

Definition at line 280 of file text_context.h.

Referenced by printAt, and printfAt.

CComputedString NL3D::CTextContext::_TempString [private]
 

Cache for for printAt() and printfAt(). This prevents from creating VBdrvinfos each time they are called (N*each frame!!).

Definition at line 279 of file text_context.h.

Referenced by printAt, and printfAt.


The documentation for this class was generated from the following files: