50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
#ifndef OGLF_H_
|
|
#define OGLF_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define OGLF_MAX_ASCII 256
|
|
#define OGLF_MAX_LINE 1024
|
|
#define OGLF_MAX_PATH 256
|
|
|
|
typedef struct oglf_char_t {
|
|
unsigned int x, y, w, h;
|
|
unsigned int x_ofs, y_ofs;
|
|
unsigned int x_advance, page;
|
|
} oglf_char_t;
|
|
|
|
typedef struct oglf_kerninfo_t {
|
|
unsigned short first, second;
|
|
short kerning;
|
|
} oglf_kerninfo_t;
|
|
|
|
typedef struct oglf_font_t {
|
|
float scale;
|
|
int base, line_h, w, h, pages, kerninfo_count;
|
|
unsigned int fontTex;
|
|
int base_list;
|
|
oglf_kerninfo_t *kerninfo;
|
|
oglf_char_t *chars;
|
|
float mmat[16];
|
|
} oglf_font_t;
|
|
|
|
int oglf_load(oglf_font_t *font, const char *bmf_path, unsigned int texture);
|
|
int oglf_width(oglf_font_t *font, const char *text);
|
|
void oglf_destroy(oglf_font_t *font);
|
|
|
|
void oglf_begin(oglf_font_t *font, int width, int height);
|
|
void oglf_end();
|
|
|
|
void oglf_print(oglf_font_t *font, float x, float y, const char *text);
|
|
void oglf_printf_al(oglf_font_t *font, int align, unsigned int *rect,
|
|
const char *fmt, ...);
|
|
void oglf_printf(oglf_font_t *font, int x, int y, const char *fmt, ...);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // _FONT_H_
|