mirror of
https://github.com/raysan5/raygui.git
synced 2026-02-20 20:49:17 -05:00
Fix GuiWindowBox border rendering with custom STATUSBAR BORDER_WIDTH (#525)
This commit is contained in:
@ -1654,13 +1654,14 @@ int GuiWindowBox(Rectangle bounds, const char *title)
|
|||||||
//GuiState state = guiState;
|
//GuiState state = guiState;
|
||||||
|
|
||||||
int statusBarHeight = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT;
|
int statusBarHeight = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT;
|
||||||
|
int statusBorderWidth = GuiGetStyle(STATUSBAR, BORDER_WIDTH);
|
||||||
|
|
||||||
Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight };
|
Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight };
|
||||||
if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f;
|
if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f;
|
||||||
|
|
||||||
const float vPadding = statusBarHeight/2.0f - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT/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 windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - (float)statusBorderWidth, bounds.width, bounds.height - (float)statusBarHeight + (float)statusBorderWidth };
|
||||||
Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT - vPadding,
|
Rectangle closeButtonRec = { statusBar.x + statusBar.width - (float)statusBorderWidth - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT - vPadding,
|
||||||
statusBar.y + vPadding, RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT, RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT };
|
statusBar.y + vPadding, RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT, RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT };
|
||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
@ -1670,8 +1671,8 @@ int GuiWindowBox(Rectangle bounds, const char *title)
|
|||||||
|
|
||||||
// Draw control
|
// Draw control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
GuiStatusBar(statusBar, title); // Draw window header as status bar
|
|
||||||
GuiPanel(windowPanel, NULL); // Draw window base
|
GuiPanel(windowPanel, NULL); // Draw window base
|
||||||
|
GuiStatusBar(statusBar, title); // Draw window header as status bar
|
||||||
|
|
||||||
// Draw window close button
|
// Draw window close button
|
||||||
int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
|
int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
|
||||||
|
|||||||
Reference in New Issue
Block a user