2021-11-30 21:29:18 -06:00
|
|
|
#ifndef FONT_H
|
|
|
|
#define FONT_H
|
|
|
|
|
|
|
|
#include "mathc.h"
|
|
|
|
|
|
|
|
struct mShader;
|
2022-06-30 10:31:23 -05:00
|
|
|
struct mSDLWindow;
|
2021-11-30 21:29:18 -06:00
|
|
|
|
|
|
|
/// Holds all state information relevant to a character as loaded using FreeType
|
|
|
|
struct Character {
|
|
|
|
uint32_t TextureID; // ID handle of the glyph texture
|
|
|
|
mfloat_t Size[2]; // Size of glyph
|
|
|
|
mfloat_t Bearing[2]; // Offset from baseline to left/top of glyph
|
|
|
|
unsigned int Advance; // Horizontal offset to advance to next glyph
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sFont {
|
|
|
|
uint32_t fontTexture;
|
|
|
|
uint32_t height;
|
2022-01-31 17:04:59 -06:00
|
|
|
struct Character Characters[127];
|
2021-11-30 21:29:18 -06:00
|
|
|
};
|
|
|
|
|
2022-06-26 08:36:38 -05:00
|
|
|
|
2022-06-30 10:31:23 -05:00
|
|
|
|
|
|
|
void font_init(struct mShader *s);
|
2022-06-26 08:36:38 -05:00
|
|
|
void font_frame(struct mSDLWindow *w);
|
2022-01-19 16:43:21 -06:00
|
|
|
struct sFont *MakeFont(const char *fontfile, int height);
|
2022-06-30 10:31:23 -05:00
|
|
|
void sdrawCharacter(struct Character c, mfloat_t cursor[2], float scale, struct mShader *shader, float color[3]);
|
2022-01-31 17:04:59 -06:00
|
|
|
void text_settype(struct sFont *font);
|
2022-06-30 10:31:23 -05:00
|
|
|
void renderText(const char *text, mfloat_t pos[2], float scale, mfloat_t color[3], float lw);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|