Immediate-Mode-UI / Immediate-Mode-UI/Nuklear

[SDL3+Emscripten] 2 issues: nk_label_wrap bleeds and ui unresponsive?

Open
#966 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.4k
Forks
686
Avg merge
4d 1h
Merged PRs (30d)
3

Description

Hi, I have 2 problems: after using esc or q key for quitting the about popup, the whole ui is responsive and the first line manifest is bleeding?

code:
```
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event* event) {
[...]
/* Remember to always rescale the event coordinates,
* if your renderer uses custom scale. */
SDL_ConvertEventToRenderCoordinates(app->renderer, event);

nk_sdl_handle_event(app->ctx, event);
if ( event->key.key == SDLK_Q | event->key.key == SDLK_ESCAPE ) {
//SDL_Log("q pressed");
if ( show_app_about == nk_true ) {
show_app_about = nk_false;
return SDL_APP_CONTINUE;
}
if ( Show_Search_Menu == nk_true ) {
Show_Search_Menu = nk_false;
return SDL_APP_CONTINUE;
}
fprintf(stdout, "nk_false: %d\n", show_app_about);
return SDL_APP_CONTINUE;
SDL_Log("exited show_app_about state and returned");
}
if ( event->key.key == SDLK_A ) {
//SDL_Log("q pressed");
show_app_about = nk_true;
fprintf(stdout, "nk_true: %d\n", show_app_about);
return SDL_APP_CONTINUE;
}
if ( event->key.key == SDLK_SLASH ) {
SDL_Log("search key invoked");
//if ( Show_Search_Menu == nk_false ) {
Show_Search_Menu = nk_true;
//SDL_Log("search menu turned on");
//}
//if ( Show_Search_Menu == nk_true ) {
//Show_Search_Menu = nk_false;
//SDL_Log("search menu turned on");
//}
fprintf(stdout, "Show_Search_Menu: %d\n", Show_Search_Menu);
return SDL_APP_CONTINUE;
}

//SDL_Log("exiting event");
return SDL_APP_CONTINUE;
}

SDL_AppResult
SDL_AppIterate(void *appstate)
{
//SDL_Log("Aber i iterate");
struct nk_sdl_app* app = (struct nk_sdl_app*)appstate;
struct nk_context* ctx = app->ctx;

nk_input_end(ctx);

/* GUI */
if (nk_begin(ctx, "ic.wiki", nk_rect(0, 0, width, height), NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE) ) {

nk_layout_row_static(ctx, (height/40), (width/20), 1);
if ( nk_button_label(ctx, "About") ) {
show_app_about = nk_true;
fprintf(stdout, "nk_true: %d\n", show_app_about);
//Open_Full_Dataset();
SDL_Log("button pressed");
}
}
[...]
if (show_app_about)
{
/* about popup */
if (nk_popup_begin(ctx, NK_POPUP_DYNAMIC, "About", NK_WINDOW_CLOSABLE|NK_WINDOW_SCALABLE, nk_rect( (width / 20) , (height / 20) , (width / 4), (height / 4) )))
{
nk_layout_row_dynamic(ctx, 10, 1);
//nk_layout_row_static(ctx, (height / 10), (width / 8.5), 50);
if (nk_tree_push(ctx, NK_TREE_NODE, "Manifest", NK_MAXIMIZED)) {
nk_label_wrap(ctx, "\176 ic.wiki is a site made by me to compare (hopefully) all of ic in the world in a flat fashion; tired to dumpster dive in to hundreds of nothingness pdf pages");
nk_label_wrap(ctx, "\176 The full dataset can be downloaded below:");
if ( nk_button_label(ctx, "https://ic.wiki/public/dataset-latest.csv.zstd") ) {
Open_Full_Dataset();
}
nk_tree_pop(ctx);
}
if (nk_tree_push(ctx, NK_TREE_NODE, "Open Source License & Credits", NK_MINIMIZED))
{
if (nk_tree_push(ctx, NK_TREE_NODE, "Powering Site", NK_MINIMIZED)) {
//nk_layout_row_dynamic(ctx, 55, 1);
if ( nk_button_label(ctx, "SDL3\54 Zlib\54 Sam Lantinga\54 1997-2026") ) {
Open_SDL_Credits();
}
if ( nk_button_label(ctx, "Nuklear ui\54 MIT\54 Micha Mettke\54 2017") ) {
Open_Nuklear_Credits();
}
if ( nk_button_label(ctx, "Emscripten\54 MIT University of Illinois NCSA Open Source License\54 Emscripten authors 2010-2014") ) {
Open_Emscripten_Credits();
}
if ( nk_button_label(ctx, "SQLite\54 Open License") ) {
Open_SQLite_Credits();
}
nk_tree_pop(ctx);
}
if (nk_tree_push(ctx, NK_TREE_NODE, "Curation of Dataset", NK_MINIMIZED)) {
if ( nk_button_label(ctx, "LibreOffice Calc") ) {
Open_LibreOffice_Credits();
}
nk_tree_pop(ctx);
}
nk_tree_pop(ctx);
}
nk_popup_end(ctx);
} else show_app_about = nk_false;
}
nk_end(ctx);
```

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two reports in SDL_AppEvent and SDL_AppIterate with the supplied SDL3/Emscripten example: the unresponsive UI after closing the About popup and the bleeding first manifest line. Trace nk_sdl_handle_event, popup handling, and nk_label_wrap, then verify both behaviors are resolved in the same setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.