From 74249a76c652fa503a2aea8f37dd88989e6e8c8d Mon Sep 17 00:00:00 2001 From: Maksym Kucherov Date: Wed, 5 Feb 2025 14:01:08 -0500 Subject: [PATCH] Expose `RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT` in `GuiWindowBox`. (#453) --- src/raygui.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index 8081cba..50474d1 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -1596,6 +1596,10 @@ int GuiWindowBox(Rectangle bounds, const char *title) #define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 24 #endif + #if !defined(RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT) + #define RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT 18 + #endif + int result = 0; //GuiState state = guiState; @@ -1604,9 +1608,12 @@ int GuiWindowBox(Rectangle bounds, const char *title) Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight }; if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f; + const float vPadding = statusBarHeight/2.0f - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT/2.0f; Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight + 1 }; - Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - 20, - statusBar.y + statusBarHeight/2.0f - 18.0f/2.0f, 18, 18 }; + Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT - vPadding, + statusBar.y + vPadding, + RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT, + RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT }; // Update control //--------------------------------------------------------------------