Updating raygui for examples

This commit is contained in:
Ray
2026-03-04 00:22:50 +01:00
parent 5ada84cc6d
commit 23c06bc6f1
3 changed files with 39 additions and 12 deletions

View File

@@ -646,6 +646,7 @@ typedef enum {
// ProgressBar
typedef enum {
PROGRESS_PADDING = 16, // ProgressBar internal padding
PROGRESS_SIDE, // ProgressBar increment side: 0-left->right, 1-right-left
} GuiProgressBarProperty;
// ScrollBar
@@ -3522,7 +3523,15 @@ int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight
}
// Draw slider internal progress bar (depends on state)
GuiDrawRectangle(progress, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED)));
if (GuiGetStyle(PROGRESSBAR, PROGRESS_SIDE) == 0) // Left-->Right
{
GuiDrawRectangle(progress, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED)));
}
else // Right-->Left
{
progress.x = bounds.x + bounds.width - progress.width - GuiGetStyle(PROGRESSBAR, BORDER_WIDTH);
GuiDrawRectangle(progress, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED)));
}
}
// Draw left/right text if provided
@@ -5119,11 +5128,11 @@ static const char *GetTextIcon(const char *text, int *iconId)
// Get text divided into lines (by line-breaks '\n')
// WARNING: It returns pointers to new lines but it does not add NULL ('\0') terminator!
static char **GetTextLines(const char *text, int *count)
static const char **GetTextLines(const char *text, int *count)
{
#define RAYGUI_MAX_TEXT_LINES 128
static char *lines[RAYGUI_MAX_TEXT_LINES] = { 0 };
static const char *lines[RAYGUI_MAX_TEXT_LINES] = { 0 };
for (int i = 0; i < RAYGUI_MAX_TEXT_LINES; i++) lines[i] = NULL; // Init NULL pointers to substrings
int textLength = (int)strlen(text);
@@ -5193,7 +5202,7 @@ static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, C
// WARNING: GuiTextSplit() function can't be used now because it can have already been used
// before the GuiDrawText() call and its buffer is static, it would be overriden :(
int lineCount = 0;
char **lines = GetTextLines(text, &lineCount);
const char **lines = GetTextLines(text, &lineCount);
// Text style variables
//int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT);