00001
00013
00014
00015
00016
00017 #ifndef __CFONT__
00018 #define __CFONT__
00019
00020 #ifdef WIN32
00021 # include <windows.h>
00022 #endif
00023
00024 #define CFONT_FIRST_CAR 33
00025 #define CFONT_LAST_CAR 126
00026 #define CFONT_NB_CAR (CFONT_LAST_CAR-CFONT_FIRST_CAR+1)
00027
00028 class CTexture;
00029
00030 typedef class CFont
00031 {
00032 private:
00033 static char *m_szBuf;
00034 static int m_iBufLength;
00035 double m_CarSizeX[256];
00036 double m_CarBeginX[256];
00037 double m_CarEndX[256];
00038 int m_iCarMinY;
00039 int m_iCarMaxY;
00040 double m_dCarMinY;
00041 double m_dCarMaxY;
00042 int m_iMaxCarW;
00043 double m_dMaxCarW;
00044 unsigned int m_uiCarRenderLists;
00045 CTexture *m_Tex;
00046 unsigned int m_uiTexId;
00047
00048 void computeWidth();
00049 void computeHeight();
00050 void distribute();
00051 void genRenderLists();
00052 void copyCar(int car,int n,unsigned char *ndata);
00053 void copyToBuffer(const char *s);
00054
00055 public:
00059 CFont(const char *,bool alpha=true);
00060 ~CFont();
00061
00067 void printString(double x,double y,double t,const char *s);
00071 void printStringN(double x,double y,double t,const char *s,int n);
00075 void printStringNeed(double t,const char *s,double *w,double *h);
00076
00077 }CFont;
00078
00079 #endif
00080