Expose RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT in GuiWindowBox. (#453)

This commit is contained in:
Maksym Kucherov
2025-02-05 14:01:08 -05:00
committed by GitHub
parent c98814df2a
commit 74249a76c6

View File

@ -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
//--------------------------------------------------------------------