Skip to content
8dcc­ edited this page Aug 10, 2023 · 7 revisions
if (nk_begin(ctx, "Nuklear", nk_rect(WINDOW_WIDTH/2 - 110, WINDOW_HEIGHT/2 - 110, 220, 220),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE))
{
    // Widgets code here
}
nk_end(ctx);

If you use the NK_WINDOW_CLOSABLE flag the end user will be able to close the window, you can check to see if a window has been closed and even re-open (or show) a window.

This trivial example add to a counter when the window has been closed by the user, after a short while the window is then shown again.

if (nk_window_is_hidden(&ctx, "Nuklear")) {
    closeCount++;
    if (closeCount > 120) {
        closeCount = 0;
        nk_window_show(&ctx, "Nuklear", NK_SHOWN);
    }
}
Clone this wiki locally