Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT customizable at runtime #436

Open
jmrico01 opened this issue Oct 27, 2024 · 2 comments
Open

Make RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT customizable at runtime #436

jmrico01 opened this issue Oct 27, 2024 · 2 comments

Comments

@jmrico01
Copy link

jmrico01 commented Oct 27, 2024

I was creating a GuiPanel with a default font size of >24, and I noticed that everything scaled nicely except the panel header, where the text is overly crammed. I poked around the implementation and noticed that this is controlled by #define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT, which is only customizable at build time (also used in GuiWindowBox, GuiScrollPanel, etc). I'm currently scaling the default font size based on the window resolution, so it would be nice to modify this status bar height at runtime.

You can see the text Menu appears very crammed here:
image

Maybe this could be made into a raygui style setting, accessible via GuiGetStyle/GuiSetStyle?

@raysan5
Copy link
Owner

raysan5 commented Dec 12, 2024

@jmrico01 there are actually several defined values that should be reviewed and probably exposed as style options...

@drasmart
Copy link
Contributor

drasmart commented Feb 3, 2025

You can pre-define them in the same file where you put RAYGUI_IMPLEMENTATION.

// modifier for illustration
static float guiScale = 1;

// as needed by design
#define RAYGUI_IMPLEMENTATION

// make your "overrides"
#define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT        24 * guiScale
// #define RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT      18 * guiScale // -- does not exist yet (see PR below)
#define RAYGUI_LINE_MARGIN_TEXT  12 * guiScale
#define RAYGUI_LINE_TEXT_PADDING  4 * guiScale
#define RAYGUI_MESSAGEBOX_BUTTON_HEIGHT    24 * guiScale
#define RAYGUI_MESSAGEBOX_BUTTON_PADDING   12 * guiScale
#define RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT      24 * guiScale
#define RAYGUI_TEXTINPUTBOX_BUTTON_PADDING     12 * guiScale
#define RAYGUI_TEXTINPUTBOX_HEIGHT             26 * guiScale
#define ICON_TEXT_PADDING   4 * guiScale
// #define RAYGUI_COLORBARALPHA_CHECKED_SIZE   10 * guiScale // -- not sure if should be scaled
#define RAYGUI_GROUPBOX_LINE_THICK  (int)guiScale
#define RAYGUI_PANEL_BORDER_WIDTH   (int)guiScale

// can do the include now
#include "raygui.h"

You can find a complete version of this code here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants