text_context_user.h

Go to the documentation of this file.
00001 
00005 /* Copyright, 2001 Nevrax Ltd.
00006  *
00007  * This file is part of NEVRAX NEL.
00008  * NEVRAX NEL is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2, or (at your option)
00011  * any later version.
00012 
00013  * NEVRAX NEL is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * General Public License for more details.
00017 
00018  * You should have received a copy of the GNU General Public License
00019  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00020  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00021  * MA 02111-1307, USA.
00022  */
00023 
00024 #ifndef NL_TEXT_CONTEXT_USER_H
00025 #define NL_TEXT_CONTEXT_USER_H
00026 
00027 #include "nel/misc/types_nl.h"
00028 #include "nel/3d/u_text_context.h"
00029 #include "nel/3d/text_context.h"
00030 #include "nel/3d/driver_user.h"
00031 
00032 
00033 namespace NL3D
00034 {
00035 
00036 
00043 class CTextContextUser : public UTextContext
00044 {
00045 private:
00046     CTextContext    _TextContext;
00047     CDriverUser     *_DriverUser;
00048     IDriver         *_Driver;
00049     CComputedString _CacheString; // Performance Optimisation
00050 
00051 public:
00052 
00054     CTextContextUser(const std::string fontFileName, const std::string fontExFileName, CDriverUser *drv, CFontManager *fmg)
00055     {
00056         nlassert(drv);
00057         _DriverUser= drv;
00058 
00059         // The enum of CComputedString and UTextContext MUST be the same!!!
00060         nlassert((uint)UTextContext::HotSpotCount== (uint)CComputedString::HotSpotCount);
00061 
00062         _Driver= drv->getDriver();
00063         _TextContext.init(_Driver, fmg);
00064         _TextContext.setFontGenerator(fontFileName, fontExFileName);
00065     }
00066     virtual ~CTextContextUser()
00067     {
00068     }
00069 
00070 
00072     // @{
00073     void setColor(NLMISC::CRGBA color);
00074     void setFontSize(uint32 fontSize) ;
00075     uint32 getFontSize() const  ;
00076     void setHotSpot(THotSpot hotSpot)  ;
00077     THotSpot getHotSpot() const ;
00078     void setScaleX(float scaleX)  ;
00079     void setScaleY(float scaleY)  ;
00080     float getScaleX() const ;
00081     float getScaleY() const ;
00082     void setShaded(bool b) ;
00083     bool            getShaded() const  ;
00084     void            setShadeExtent(float shext) ;
00085     void            setShadeColor (NLMISC::CRGBA sc);
00086     NLMISC::CRGBA   getShadeColor () const;
00087     void setKeep800x600Ratio(bool keep);
00088     bool getKeep800x600Ratio() const;
00089     // @}
00090 
00091 
00093 
00096     // @{
00097     uint32 textPush(const char *format, ...)  ;
00098     uint32 textPush(const ucstring &str)  ;
00099     void setStringColor(uint32 i, CRGBA newCol);
00100     void setStringSelection(uint32 i, uint32 selectStart, uint32 selectSize);
00101     void resetStringSelection(uint32 i);
00102     void erase(uint32 i)  ;
00103     virtual CStringInfo     getStringInfo (uint32 i);
00104     virtual CStringInfo     getStringInfo (const ucstring &ucstr);
00105 
00106     void clear()  ;
00107     void printAt(float x, float y, uint32 i) ;
00108     void printClipAt(URenderStringBuffer &renderBuffer, float x, float y, uint32 i, float xmin, float ymin, float xmax, float ymax) ;
00109     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);
00110     void printClipAtOld (float x, float y, uint32 i, float xmin, float ymin, float xmax, float ymax);
00111 
00112     void printAt(float x, float y, const ucstring &ucstr) ;
00113     void printfAt(float x, float y, const char * format, ...) ;
00114 
00115     void render3D(const CMatrix &mat, const ucstring &ucstr) ;
00116     void render3D(const CMatrix &mat, const char *format, ...) ;
00117 
00118     float getLastXBound() const ;
00119     // @}
00120 
00121     void            dumpCacheTexture (const char *filename);
00122 
00123     virtual URenderStringBuffer     *createRenderBuffer();
00124     virtual void                    deleteRenderBuffer(URenderStringBuffer *buffer);
00125     virtual void                    flushRenderBuffer(URenderStringBuffer *buffer);
00126     virtual void                    flushRenderBufferUnProjected(URenderStringBuffer *buffer, bool zwrite);
00127 
00128     CTextContext    &getTextContext() {return _TextContext;}
00129 
00131 
00134     // @{
00135     virtual void setLetterColors(ULetterColors * letterColors, uint index);
00136     virtual bool isSameLetterColors(ULetterColors * letterColors, uint index);
00137     virtual ULetterColors * createLetterColors();
00138     // @}
00139 };
00140 
00141 
00142 } // NL3D
00143 
00144 
00145 #endif // NL_TEXT_CONTEXT_USER_H
00146 
00147 /* End of text_context_user.h */

Generated on Thu Jan 7 08:26:20 2010 for NeL by  doxygen 1.6.1