You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make the text renderer pluggable, with support for multiple platforms. This idea is slightly extended from the N64 port:
# This replaces the text_settings struct.
typedef struct textbox {
bool dirty;
void *userdata;
char *data;
size_t len;
text_valign valign;
text_halign halign;
// ... and all the other options
} textbox;
typedef struct text_engine {
init_cb init;
render_cb render; // Called to generate the layout and do the render
close_cb close; // Called when shutting down the renderer (app exit, renderer change)
} text_engine;
// First, initialize any engine we have. One of these:
// These will set the callback pointers to text_engine.
text_engine engine;
void freetype_engine_init(&engine);
void monospace_engine_init(&engine); // Our old thing
// Then, set it to be used. This would set static variable.
void renderer_engine_set(&engine);
// These replace the old text_settings struct
// Calling any of these sets the dirty = true flag,
void textbox_create(textbox *box);
void textbox_create_with(textbox *box, /* other options for single line call */);
void textbox_from_c(textbox *box, const char *src);
void textbox_from_str(textbox *box, const str *src);
void textbox_set_valign(textbox *box, text_valign valign);
// Calls the text_engine.render(). Render would check if dirty is set, and would do the layout thing
// and set the userdata pointer with cached data (whatever it is). Then just call video renderer with
// whatever needs to be done.
void textbox_render(textbox *box);
The text was updated successfully, but these errors were encountered:
Make the text renderer pluggable, with support for multiple platforms. This idea is slightly extended from the N64 port:
The text was updated successfully, but these errors were encountered: