Skip to content
StunxFS edited this page Aug 22, 2022 · 6 revisions
char buffer[256]; // must be out of the func of GuiMain()

void GuiInit() { // this function should be call before GuiMain() and keep it run 1 time
   strcpy(buffer, "This is some content"); // if us want to init a default text for the text edit
}

void GuiMain() {
   nk_begin(...); // create a nk_window
   // must be keep the fllow code between nk_begin and nk_end
   nk_flags event = nk_edit_string_zero_terminated(
      ctx, 
      NK_EDIT_BOX | NK_EDIT_AUTO_SELECT, // focus will auto select all text (NK_EDIT_BOX not sure)
      buffer, sizeof(buffer), nk_filter_ascii // nk_filter_ascii Text Edit accepts text types.
   );
   nk_end(ctx); // end a nk_window
}
Clone this wiki locally