mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-10 01:09:10 -04:00
Updating raygui for examples
This commit is contained in:
@ -646,6 +646,7 @@ typedef enum {
|
|||||||
// ProgressBar
|
// ProgressBar
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PROGRESS_PADDING = 16, // ProgressBar internal padding
|
PROGRESS_PADDING = 16, // ProgressBar internal padding
|
||||||
|
PROGRESS_SIDE, // ProgressBar increment side: 0-left->right, 1-right-left
|
||||||
} GuiProgressBarProperty;
|
} GuiProgressBarProperty;
|
||||||
|
|
||||||
// ScrollBar
|
// ScrollBar
|
||||||
@ -3522,7 +3523,15 @@ int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw slider internal progress bar (depends on state)
|
// 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
|
// 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')
|
// Get text divided into lines (by line-breaks '\n')
|
||||||
// WARNING: It returns pointers to new lines but it does not add NULL ('\0') terminator!
|
// 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
|
#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
|
for (int i = 0; i < RAYGUI_MAX_TEXT_LINES; i++) lines[i] = NULL; // Init NULL pointers to substrings
|
||||||
|
|
||||||
int textLength = (int)strlen(text);
|
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
|
// 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 :(
|
// before the GuiDrawText() call and its buffer is static, it would be overriden :(
|
||||||
int lineCount = 0;
|
int lineCount = 0;
|
||||||
char **lines = GetTextLines(text, &lineCount);
|
const char **lines = GetTextLines(text, &lineCount);
|
||||||
|
|
||||||
// Text style variables
|
// Text style variables
|
||||||
//int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT);
|
//int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT);
|
||||||
|
|||||||
@ -646,6 +646,7 @@ typedef enum {
|
|||||||
// ProgressBar
|
// ProgressBar
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PROGRESS_PADDING = 16, // ProgressBar internal padding
|
PROGRESS_PADDING = 16, // ProgressBar internal padding
|
||||||
|
PROGRESS_SIDE, // ProgressBar increment side: 0-left->right, 1-right-left
|
||||||
} GuiProgressBarProperty;
|
} GuiProgressBarProperty;
|
||||||
|
|
||||||
// ScrollBar
|
// ScrollBar
|
||||||
@ -3522,7 +3523,15 @@ int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw slider internal progress bar (depends on state)
|
// 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
|
// 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')
|
// Get text divided into lines (by line-breaks '\n')
|
||||||
// WARNING: It returns pointers to new lines but it does not add NULL ('\0') terminator!
|
// 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
|
#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
|
for (int i = 0; i < RAYGUI_MAX_TEXT_LINES; i++) lines[i] = NULL; // Init NULL pointers to substrings
|
||||||
|
|
||||||
int textLength = (int)strlen(text);
|
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
|
// 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 :(
|
// before the GuiDrawText() call and its buffer is static, it would be overriden :(
|
||||||
int lineCount = 0;
|
int lineCount = 0;
|
||||||
char **lines = GetTextLines(text, &lineCount);
|
const char **lines = GetTextLines(text, &lineCount);
|
||||||
|
|
||||||
// Text style variables
|
// Text style variables
|
||||||
//int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT);
|
//int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT);
|
||||||
|
|||||||
@ -646,6 +646,7 @@ typedef enum {
|
|||||||
// ProgressBar
|
// ProgressBar
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PROGRESS_PADDING = 16, // ProgressBar internal padding
|
PROGRESS_PADDING = 16, // ProgressBar internal padding
|
||||||
|
PROGRESS_SIDE, // ProgressBar increment side: 0-left->right, 1-right-left
|
||||||
} GuiProgressBarProperty;
|
} GuiProgressBarProperty;
|
||||||
|
|
||||||
// ScrollBar
|
// ScrollBar
|
||||||
@ -3522,7 +3523,15 @@ int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw slider internal progress bar (depends on state)
|
// 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
|
// 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')
|
// Get text divided into lines (by line-breaks '\n')
|
||||||
// WARNING: It returns pointers to new lines but it does not add NULL ('\0') terminator!
|
// 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
|
#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
|
for (int i = 0; i < RAYGUI_MAX_TEXT_LINES; i++) lines[i] = NULL; // Init NULL pointers to substrings
|
||||||
|
|
||||||
int textLength = (int)strlen(text);
|
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
|
// 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 :(
|
// before the GuiDrawText() call and its buffer is static, it would be overriden :(
|
||||||
int lineCount = 0;
|
int lineCount = 0;
|
||||||
char **lines = GetTextLines(text, &lineCount);
|
const char **lines = GetTextLines(text, &lineCount);
|
||||||
|
|
||||||
// Text style variables
|
// Text style variables
|
||||||
//int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT);
|
//int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT);
|
||||||
|
|||||||
Reference in New Issue
Block a user