00001 00016 #ifndef CUI_VARBMFONT_H 00017 #define CUI_VARBMFONT_H 00018 00019 #include "UI_Lib.h" 00020 #include "UI_types.h" 00021 #include "IUI_Renderer.h" 00022 #include "IUI_Font.h" 00023 00025 00031 class GLGUI_ENTRY CUI_VarBMFont : public IUI_Font 00032 { 00033 public: 00035 00042 CUI_VarBMFont( IUI_Shader *shader = NULL, 00043 int xres = 256, int yres = 256, 00044 unsigned char *widths = NULL ); 00045 00047 virtual ~CUI_VarBMFont(); 00048 00050 virtual bool CalculateLookupTable( unsigned char *widths ); 00051 00053 00058 virtual bool RenderText( double dtime, IUI_Renderer *renderer, char *text ); 00059 00061 00064 virtual bool RenderText( double dtime, IUI_Renderer *renderer, char *text, unsigned int columns, unsigned int rows, 00065 unsigned int startColumn, unsigned int startRow, bool wrap, 00066 unsigned int &textColumns, unsigned int &textRows, 00067 bool invert = false, 00068 unsigned int cursorPosition = 0, unsigned short cursorType = UI_CURSOR_NONE 00069 ); 00070 00072 virtual bool Count( char *text, unsigned int columns, unsigned int rows, 00073 bool wrap, unsigned int &textColumns, unsigned int &textRows ); 00074 00076 virtual bool SetShader( IUI_Shader *shader ) 00077 { m_shader = shader; return false; } 00078 00080 virtual bool SetWidths( unsigned char *widths ) 00081 { return CalculateLookupTable( widths ); } 00082 00083 protected: 00084 00086 IUI_Shader *m_shader; 00087 00089 int m_resx; 00091 int m_resy; 00092 00094 v4_f m_textureTable[256*4]; 00095 00097 float m_charwidth[256]; 00098 00099 }; 00100 00101 #endif