Skip to content
8dcc­ edited this page Aug 13, 2023 · 6 revisions
/* Global so it can be accessed by both functions */
char buffer[256];

/* This function should be called before GuiMain() in case we wanted to
 * initialize the buffer with some value. */
void GuiInit() {
    strcpy(buffer, "This is some content");
}

void GuiMain() {
    if (nk_begin(...)) {
        nk_flags event = nk_edit_string_zero_terminated(
          ctx,
          NK_EDIT_BOX | NK_EDIT_AUTO_SELECT,       /* Auto-select for focusing the text on click */
          buffer, sizeof(buffer), nk_filter_ascii  /* nk_filter_ascii: text type */
        );
    }
    nk_end(ctx);
}
Clone this wiki locally