42 lines
1.3 KiB
C
42 lines
1.3 KiB
C
#pragma once
|
|
#include "opengl.h"
|
|
|
|
// Font info.
|
|
typedef struct glFont_ {
|
|
int h; // Height.
|
|
int* w;
|
|
GLuint* textures;
|
|
GLuint 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, ...);
|
|
|
|
// Get the width of the text that you wish to print.
|
|
int gl_printWidth(const glFont* ft_font, const char* fmt, ...);
|
|
|
|
int gl_printHeight(const glFont* ft_font, const int width,
|
|
const char* fmt, ...);
|
|
|