1 #ifndef CMU462_TEXTOSD_H
2 #define CMU462_TEXTOSD_H
12 struct FT_LibraryRec_;
13 typedef struct FT_LibraryRec_* FT_Library;
15 typedef struct FT_FaceRec_* FT_Face;
20 extern "C" char osdfont_base64[];
79 void resize(
size_t w,
size_t h);
95 int add_line(
float x,
float y, std::string text =
"",
96 size_t size = 16,
Color color = Color::White);
112 void set_anchor(
int line_id,
float x,
float y);
120 void set_text(
int line_id, std::string text);
128 void set_size(
int line_id,
size_t size);
141 void draw_line(OSDLine line);
150 char* font;
size_t font_size;
151 FT_Library* ft; FT_Face* face;
154 std::vector<OSDLine> lines;
159 GLint attribute_coord;
164 GLuint compile_shaders();
165 GLint get_attribu(GLuint program,
const char *name);
166 GLint get_uniform(GLuint program,
const char *name);
172 #endif // CMU462_TEXTOSD_H
void set_size(int line_id, size_t size)
Set the font size of a given line.
Definition: osdtext.cpp:153
void resize(size_t w, size_t h)
Resize internal scales when context size has changed.
Definition: osdtext.cpp:93
void set_color(int line_id, Color color)
Set the font color of a given line.
Definition: osdtext.cpp:164
void set_anchor(int line_id, float x, float y)
Set the anchor position of a given line.
Definition: osdtext.cpp:130
int add_line(float x, float y, std::string text="", size_t size=16, Color color=Color::White)
Add a line of text to the OSD.
Definition: osdtext.cpp:99
void del_line(int line_id)
Deletes a line.
Definition: osdtext.cpp:119
~OSDText()
Destructor.
Definition: osdtext.cpp:30
int init()
Initializes resources required for rendering text.
Definition: osdtext.cpp:41
void render()
Draw the text OSD.
Definition: osdtext.cpp:80
void set_text(int line_id, std::string text)
Set the text of a given line.
Definition: osdtext.cpp:142
Provides an interface for text on-screen display.
Definition: osdtext.h:47
OSDText()
Constructor.
Definition: osdtext.cpp:22
Encodes a color via additive red, green, and blue chanel values.
Definition: color.h:13