raysan5 / raygui

A simple and easy-to-use immediate-mode gui library
zlib License
3.36k stars 289 forks source link

Fixed incorrect position of the GuiWindowBox closing icon with the de… #318

Closed akimky closed 1 year ago

akimky commented 1 year ago

…fined RAYGUI_NO_ICONS macro.

In the absence of the added check, and disabled icons, the closing icon of the Gui Window Box was to the left of the center, although it should be strictly centered.

raysan5 commented 1 year ago

@Akimpaus Please, could you provide some images illustrating the change?

akimky commented 1 year ago

@raysan5 In fact, it's not just about GuiWindowBox. Pay attention to the positioning of the icon substitutes. image

akimky commented 1 year ago

Example code

#include <raylib.h>
#define RAYGUI_IMPLEMENTATION
#define RAYGUI_NO_ICONS
#include <raygui.h>

int main() {

    InitWindow(800, 600, "Test");

    const Rectangle windowBoxBounds = {
        300,
        50,
        100,
        100
    };

    const Rectangle spinnerBounds = {
        300,
        160,
        200,
        25
    };
    int spinnerValue = 0;
    bool spinnerEdit = false;

    while (!WindowShouldClose()) {

        BeginDrawing();
        ClearBackground(BLACK);

        GuiWindowBox(windowBoxBounds, "test");
        spinnerEdit = GuiSpinner(spinnerBounds, "test", &spinnerValue, 0, 100, spinnerEdit);

        EndDrawing();
    }

    CloseWindow();
    return 0;
}
raysan5 commented 1 year ago

@Akimpaus Thanks for the details and the review!