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[];
68 int init(
bool use_hdpi);
85 void resize(
size_t w,
size_t h);
101 int add_line(
float x,
float y, std::string text =
"",
102 size_t size = 16,
Color color = Color::White);
119 void set_anchor(
int line_id,
float x,
float y);
127 void set_text(
int line_id, std::string text);
135 void set_size(
int line_id,
size_t size);
148 void draw_line(OSDLine line);
160 char* font;
size_t font_size;
161 FT_Library* ft; FT_Face* face;
164 std::vector<OSDLine> lines;
169 GLint attribute_coord;
174 GLuint compile_shaders();
175 GLint get_attribu(GLuint program,
const char *name);
176 GLint get_uniform(GLuint program,
const char *name);
182 #endif // CMU462_TEXTOSD_H
void set_size(int line_id, size_t size)
Set the font size of a given line.
Definition: osdtext.cpp:164
void resize(size_t w, size_t h)
Resize internal scales when context size has changed.
Definition: osdtext.cpp:101
void set_color(int line_id, Color color)
Set the font color of a given line.
Definition: osdtext.cpp:175
int init(bool use_hdpi)
Initializes resources required for rendering text.
Definition: osdtext.cpp:43
void set_anchor(int line_id, float x, float y)
Set the anchor position of a given line.
Definition: osdtext.cpp:141
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:107
void del_line(int line_id)
Deletes a line.
Definition: osdtext.cpp:130
~OSDText()
Destructor.
Definition: osdtext.cpp:32
void clear()
Clear all the lines.
Definition: osdtext.cpp:97
void render()
Draw the text OSD.
Definition: osdtext.cpp:84
void set_text(int line_id, std::string text)
Set the text of a given line.
Definition: osdtext.cpp:153
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:15