Skip to content

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

Description

@shabbah11

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions