#ifndef __GLFONTENGINE_H #define __GLFONTENGINE_H #include #include #include #include #include #include #include #include "gltexture.h" #include "glcolor.h" class GLFont { public: GLFont(std::string fontfile, float cwdth) { charwidth = cwdth; font = new GLTexture(fontfile); } ~GLFont() { delete(font); } GLTexture* font; float charwidth; }; class GLFontEngine { private: static std::map fontpool; GLFont *font; bool fontloaded; GLColor col; // float r, g, b, a; int fsize; void init(); public: static bool addFont(std::string fontfile, std::string fontname); static void quit(); static void prepare2DbyPushingMatrix(); static void regain3DbyPoppingMatrix(); static void paintSDLRect(SDL_Rect); GLFontEngine(); GLFontEngine(std::string); bool fontSelect(std::string); void setColor(float, float, float, float=1.0f); void setColor(GLColor); void renderText(std::string, SDL_Rect); // wrapper // void renderText(std::string, int x, int y, *SDL_Rect=0, bool center=false); // void renderLines(std::string, int x, int y, void renderLine(std::string, SDL_Rect); void renderLine(std::string, int x, int y, bool center=false, SDL_Rect *rendered_to=0); void renderLines(std::string, int x, int y, bool center=false, SDL_Rect *rendered_to=0, int wrap=0, int paintbackground=0); void setSize(int); int getSize(); void getSDLRect(const std::string&, SDL_Rect*); int getTextWidth(const std::string&); }; #endif