Skip to content

Instantly share code, notes, and snippets.

@ermiry
Created January 3, 2020 23:05
Show Gist options
  • Save ermiry/156b33803516b2ac5ac36b8f117b159d to your computer and use it in GitHub Desktop.
Save ermiry/156b33803516b2ac5ac36b8f117b159d to your computer and use it in GitHub Desktop.
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/font.h"
#include "cengine/ui/textbox.h"
// creates and display a textbox at the center of the screen
void display_text (const char *text) {
Renderer *main_renderer = renderer_get_by_name ("main");
Font *font = ui_font_get_default ();
TextBox *textbox = ui_textbox_create (0, 0, 200, 50, UI_POS_MIDDLE_CENTER, main_renderer);
ui_textbox_set_text (textbox, main_renderer, text, font, 24, RGBA_WHITE, false);
ui_textbox_set_text_pos (textbox, UI_POS_MIDDLE_CENTER);
ui_element_set_layer (main_renderer->ui, textbox->ui_element, "top");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment