|
Untitled
|
Functions that modify TextBoxes and load Fonts. More...
Go to the source code of this file.
Functions | |
| void | FONTS_INIT () |
| Simply clears the FONTS buffer and re-initializes the Vector. | |
| int | find_empty_text_box_slot (UIMenu *m) |
| Finds an empty slot for a TextBox that is marked as free. | |
| Font * | read_json_msdf (const char *json_path, const char *png_path) |
| Reads the JSON for an MSDF Font, and creates a Font from it. | |
| void | determine_text_box_dimensions (TextBox *tb, float *width, float *height) |
| Determines TextBox dimensions by iterating through its text as if it was rendering the Font. | |
| void | move_text_box_to_origin (TextBox *box) |
| Moves a TextBox to \((0, 0)\), while accounting for Justify. | |
| int | create_text_box (int menu_id) |
| Creates a DEFAULT_TEXT_BOX. | |
| void | delete_text_box (int menu, int id) |
| Deletes a TextBox and its text and frees it from the UIMenu. | |
Variables | |
| Vector | FONTS |
| All loaded Fonts. | |
|
inline |
Simply clears the FONTS buffer and re-initializes the Vector.
Definition at line 21 of file fonts.h.
References Vector::buffer, FONTS, FONTS_INIT(), and init_vector().
Referenced by FONTS_INIT(), and init().
| int find_empty_text_box_slot | ( | UIMenu * | m | ) |
Finds an empty slot for a TextBox that is marked as free.
| m | The UIMenu to search. |
Definition at line 21 of file fonts.c.
References find_empty_text_box_slot(), TextBox::free, MAX_TEXT_BOXES, and UIMenu::text_boxes.
Referenced by create_text_box(), find_empty_text_box_slot(), and move_text_box_to_menu().
| Font * read_json_msdf | ( | const char * | json_path, |
| const char * | png_path ) |
Reads the JSON for an MSDF Font, and creates a Font from it.
| json_path | The path to the json. |
| png_path | The path to the png. |
Definition at line 33 of file fonts.c.
References Vector::count, FONTS, Font::glyph_count, Font::glyphs, Glyph::height, Font::highest_dist, Font::highest_y, Font::id, Glyph::id, Font::name, read_json_msdf(), Font::tex_h, Font::tex_w, Glyph::u0, Glyph::u1, Glyph::v0, Glyph::v1, vector_expand(), Glyph::width, Glyph::xadvance, Glyph::xoffset, and Glyph::yoffset.
Referenced by init_globals(), and read_json_msdf().
| void determine_text_box_dimensions | ( | TextBox * | tb, |
| float * | width, | ||
| float * | height ) |
Determines TextBox dimensions by iterating through its text as if it was rendering the Font.
| tb | The TextBox. |
| width | Pointer to out width. |
| height | Pointer to out height. |
Definition at line 97 of file fonts.c.
References CAST_VEC, determine_text_box_dimensions(), TextBox::font_id, FONTS, Font::glyph_count, Font::glyphs, Glyph::height, Font::highest_dist, TextBox::start, Font::tex_h, Font::tex_w, TextBox::text, TextBox::text_size, Glyph::u0, Glyph::u1, Glyph::v0, Glyph::v1, TextBox::w, Glyph::width, vec2::x, Glyph::xadvance, Glyph::xoffset, vec2::y, and Glyph::yoffset.
Referenced by determine_text_box_dimensions(), and move_text_box_to_origin().
| void move_text_box_to_origin | ( | TextBox * | box | ) |
Moves a TextBox to \((0, 0)\), while accounting for Justify.
| box | The TextBox to move. |
Definition at line 150 of file fonts.c.
References TextBox::center, determine_text_box_dimensions(), TextBox::h, TextBox::justify, JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, move_text_box_to_origin(), TextBox::start, TextBox::w, vec2::x, and vec2::y.
Referenced by create_performance_overlay(), create_text_box(), move_text_box_to_origin(), and update_performance_overlay().
| int create_text_box | ( | int | menu_id | ) |
Creates a DEFAULT_TEXT_BOX.
| menu_id | The target UIMenu. |
Definition at line 202 of file fonts.c.
References CAST_VEC, create_text_box(), DEFAULT_TEXT_BOX, find_empty_text_box_slot(), TextBox::menu, MENUS, move_text_box_to_origin(), TextBox::text, UIMenu::text_boxes, TextBox::text_cap, TextBox::uID, and UIMenu::uID.
Referenced by create_text_box(), render_text_menu(), and render_ui_menu().
| void delete_text_box | ( | int | menu, |
| int | id ) |
Deletes a TextBox and its text and frees it from the UIMenu.
Definition at line 184 of file fonts.c.
References CAST_VEC, UIMenu::containers, DEFAULT_TEXT_BOX, delete_text_box(), TextBox::free, MENUS, TextBox::parent_container, remove_text_box_from_container(), TextBox::text, and UIMenu::text_boxes.
Referenced by delete_text_box(), execute_text_box_undo(), execute_ui_element_undo(), move_text_box_to_menu(), render_text_menu(), and render_ui_menu().
|
extern |
All loaded Fonts.
Definition at line 14 of file fonts.c.
Referenced by add_text_box(), determine_text_box_dimensions(), FONTS_INIT(), read_json_msdf(), render(), scene_load(), and scene_save().