mirror of
https://github.com/raysan5/raygui.git
synced 2026-02-20 20:49:17 -05:00
Update raygui.h
This commit is contained in:
@ -5124,19 +5124,18 @@ static const char **GetTextLines(const char *text, int *count)
|
|||||||
#define RAYGUI_MAX_TEXT_LINES 128
|
#define RAYGUI_MAX_TEXT_LINES 128
|
||||||
|
|
||||||
static const 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);
|
||||||
|
|
||||||
lines[0] = text;
|
lines[0] = text;
|
||||||
*count = 1;
|
*count = 1;
|
||||||
|
|
||||||
for (int i = 0, k = 0; (i < textLength) && (*count < RAYGUI_MAX_TEXT_LINES); i++)
|
for (int i = 0; (i < textLength) && (*count < RAYGUI_MAX_TEXT_LINES); i++)
|
||||||
{
|
{
|
||||||
if (text[i] == '\n')
|
if ((text[i] == '\n') && ((i + 1) < textLength))
|
||||||
{
|
{
|
||||||
k++;
|
lines[*count] = &text[i + 1];
|
||||||
lines[k] = &text[i + 1]; // WARNING: next value is valid?
|
|
||||||
*count += 1;
|
*count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user