#ifndef _FONT_H #define _FONT_H #include "common.h" #include "vector.h" #include #include #include #include #include class FontBase { protected: bool is_valid; Vector4 color; public: FontBase(): is_valid(false), color(1.0,1.0,1.0,1.0) {} FontBase(const char *file): is_valid(true) {} virtual bool IsValid() {return is_valid;} // your everyday IsValid function, false if there's a problem virtual void Color(const Vector4 &color) {this->color=color;} // set the rendering color virtual Vector4 Color() {return color;} // get the rendering color virtual void Render(int x,int y,const char *text)=0; // render the text at a screenspace location }; class TrueTypeFont: public FontBase { protected: float pt; FT_Face face; friend class FontOpenGL; friend class FontD3D9; public: TrueTypeFont(): FontBase() {} TrueTypeFont(const char *file,int pt); // this constructor loads a truetype/freetype font ~TrueTypeFont(); virtual void Render(int x,int y,const char *text) {} // devirtualize the render function, but no direct surface rendering }; #endif