Skip to content

[QUESTION] Whay the window doesn´t close? #831

@RafaDEV99

Description

@RafaDEV99

Ok, when I close the window, the window doesn´t close, and if I reposition it, the window resets to the original position. By the way, I'm a beginner.

Here is my test code:

#include <math.h>
#include <raylib.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

#define RAYLIB_NUKLEAR_IMPLEMENTATION
#include "../Includes/raylib-nuklear.h"

int main() {
    InitWindow(1080, 700, "raylib-nuklear example");
    SetWindowState(FLAG_WINDOW_RESIZABLE);

    // Create the Nuklear Context
    int fontSize = 10;
    bool show_window = true;
    struct nk_context *ctx = InitNuklear(fontSize);
    struct nk_rect boundsA = {50, 50, 200, 200};
    struct nk_rect boundsB = {300, 50, 200, 200};
    int windowOptions = NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_MINIMIZABLE|NK_WINDOW_CLOSABLE|NK_WINDOW_MOVABLE;

    static int show_group =  1;
    enum {EASY, HARD};
    static int op = EASY;
    static float value = 0.6f;
    static int i =  20;

    char windowName[] = "My window";

    while (!WindowShouldClose()) {
        // Update the Nuklear context, along with input
        UpdateNuklear(ctx);

        // Nuklear GUI Code
        // https://github.com/Immediate-Mode-UI/Nuklear/wiki/Window
        if (nk_begin(ctx, windowName, boundsA, windowOptions) && (show_window))
        {
            // GUI widgets
        }
        nk_end(ctx);

        // Render
        BeginDrawing();
            ClearBackground(RAYWHITE);

            // Render the Nuklear GUI
            DrawNuklear(ctx);

        EndDrawing();
    }

    // De-initialize the Nuklear GUI
    UnloadNuklear(ctx);

    CloseWindow();
    return 0;
}

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