mirror of
https://github.com/raysan5/raygui.git
synced 2025-12-25 10:22:33 -05:00
Support font loading on text RGS
This commit is contained in:
22
src/raygui.h
22
src/raygui.h
@ -539,8 +539,8 @@ static GuiTextBoxState guiTextBoxState = { .cursor = -1, .start = 0, .index = 0,
|
|||||||
#define CLITERAL (Color)
|
#define CLITERAL (Color)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WHITE CLITERAL{ 255, 255, 255, 255 } // White
|
#define WHITE CLITERAL{ 255, 255, 255, 255 } // White -- GuiColorBarAlpha()
|
||||||
#define BLACK CLITERAL{ 0, 0, 0, 255 } // Black
|
#define BLACK CLITERAL{ 0, 0, 0, 255 } // Black -- GuiColorBarAlpha()
|
||||||
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
|
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
|
||||||
#define GRAY CLITERAL{ 130, 130, 130, 255 } // Gray -- GuiColorBarAlpha()
|
#define GRAY CLITERAL{ 130, 130, 130, 255 } // Gray -- GuiColorBarAlpha()
|
||||||
|
|
||||||
@ -4021,6 +4021,22 @@ RAYGUIDEF void GuiLoadStyle(const char *fileName)
|
|||||||
else GuiSetStyle(controlId, propertyId, propertyValue);
|
else GuiSetStyle(controlId, propertyId, propertyValue);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
case 'f':
|
||||||
|
{
|
||||||
|
int fontSize = 0;
|
||||||
|
int fontSpacing = 0;
|
||||||
|
char fontFileName[256] = { 0 };
|
||||||
|
sscanf(buffer, "f %d %d %[^\n]s", &fontSize, &fontSpacing, fontFileName);
|
||||||
|
|
||||||
|
Font font = LoadFontEx(FormatText("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0);
|
||||||
|
|
||||||
|
if ((font.texture.id > 0) && (font.charsCount > 0))
|
||||||
|
{
|
||||||
|
GuiFont(font);
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, fontSize);
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SPACING, fontSpacing);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4038,8 +4054,6 @@ RAYGUIDEF void GuiLoadStyle(const char *fileName)
|
|||||||
rgsFile = fopen(fileName, "rb");
|
rgsFile = fopen(fileName, "rb");
|
||||||
|
|
||||||
if (rgsFile == NULL) return;
|
if (rgsFile == NULL) return;
|
||||||
|
|
||||||
unsigned int value = 0;
|
|
||||||
|
|
||||||
char signature[5] = "";
|
char signature[5] = "";
|
||||||
short version = 0;
|
short version = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user