Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

FontGl.h

00001 00002 00003 #ifndef MOD_FONTGL_H 00004 #define MOD_FONTGL_H 00005 00006 //Licence: LGPL 00007 //Copyright: Visti Andresen 00008 00009 #include "Font.h" 00010 #include "SFontLoader.h" 00011 00012 /**A font for rendering on a OpenGL display.*/ 00013 class FontGl : public Font 00014 { 00015 public: 00016 FontGl(); 00017 ~FontGl(); 00018 void prepareDrawing(); 00019 /**Sets display size hints for the font. 00020 00021 the virtualWidth and virtualHeight defines the range of coordinates 00022 regardless of actual display size, coordinates and font size will be 00023 scaled to fit the actual display size. 00024 00025 displayWidth and displayHeight are the actual display size. 00026 */ 00027 void setScreenSize(float virtualWidth, float virtualHeight, 00028 int displayWidth, int displayHeight); 00029 00030 /**Loads a SFont file. 00031 00032 fileName is the name (may include path) of the SFont. 00033 00034 fontDefinition is a string containing the letters in the SFont.*/ 00035 void loadFontGfx(const string &fileName, const string &fontDefinition= 00036 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); 00037 void printChar(const char data, float x, float y, float zoom); 00038 void printString(const string &value, float x, float y, float zoom); 00039 float getWidth(const string &data, float zoom); 00040 float getHeight(float zoom); 00041 /**Frees the OpenGL texture memory used by the font, call this before reloading the font.*/ 00042 void unloadFontGfx(); 00043 00044 private: 00045 GLuint images_[256]; 00046 float charWidth_[256]; 00047 float charHeight_; 00048 float fontCellWidth_; 00049 float fontCellHeight_; 00050 float screenWidth_; 00051 float screenHeight_; 00052 int displayWidth_; 00053 int displayHeight_; 00054 }; 00055 00056 00057 #endif

Generated on Wed Sep 1 14:46:57 2004 by doxygen 1.3.7