#pragma once #include "opengl.h" /** * struct glFont * * @brief Represents a font in memory. */ typedef struct glFont_ { int h; /**< Font height. */ int* w; /**< Width of each font member. */ GLuint* textures; /**< Textures in the font. */ GLuint list_base; /**< Display list base. */ } glFont; extern glFont gl_defFont; /**< Default font. */ extern glFont gl_smallFont; /**< Small font. */ /* glFont loading/freeing. */ /* If font is NULL it uses the internal default font, same with gl_print */ void gl_fontInit(glFont* font, const char* fname, const unsigned int h); void gl_freeFont(glFont* font); /* Print text. */ void gl_print(const glFont* ft_font, const double x, const double y, const glColour* c, const char* fmt, ...); /* Print text to a max length. */ int gl_printMax(const glFont* ft_font, const int max, const double x, const double y, const glColour* c, const char* fmt, ...); /* Print text centered in width at x. */ int gl_printMid(const glFont* ft_font, const int width, double x, const double y, const glColour* c, const char* fmt, ...); /* Respects \n -> bx, by is top left position. */ int gl_printText(const glFont* ft_font, const int width, const int height, double bx, double by, glColour* c, const char* fmt, ...); /* Dimension stuff. */ int gl_printWidthForText(const glFont* ft_font, char* text, const int width); int gl_printWidth(const glFont* ft_font, const char* fmt, ...); int gl_printHeight(const glFont* ft_font, const int width, const char* fmt, ...);