Fixed: incompatible type for argument 1 of 'UnloadTexture' (#169)

This commit is contained in:
Damien Pitard 2021-12-19 12:32:42 +01:00 committed by GitHub
parent 38bda86911
commit 733fa0fce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3282,7 +3282,7 @@ Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
void GuiLoadStyle(const char *fileName) void GuiLoadStyle(const char *fileName)
{ {
#define MAX_LINE_BUFFER_SIZE 256 #define MAX_LINE_BUFFER_SIZE 256
bool tryBinary = false; bool tryBinary = false;
// Try reading the files as text file first // Try reading the files as text file first
@ -3335,16 +3335,16 @@ void GuiLoadStyle(const char *fileName)
int *values = (int *)RAYGUI_MALLOC(glyphCount*sizeof(int)); int *values = (int *)RAYGUI_MALLOC(glyphCount*sizeof(int));
for (int i = 0; i < glyphCount; i++) values[i] = TextToInteger(chars[i]); for (int i = 0; i < glyphCount; i++) values[i] = TextToInteger(chars[i]);
if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture.id); if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture);
font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, values, glyphCount); font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, values, glyphCount);
if (font.texture.id == 0) font = GetFontDefault(); if (font.texture.id == 0) font = GetFontDefault();
RAYGUI_FREE(values); RAYGUI_FREE(values);
} }
} }
else else
{ {
if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture.id); if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture);
font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0); font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0);
if (font.texture.id == 0) font = GetFontDefault(); if (font.texture.id == 0) font = GetFontDefault();
} }
@ -3439,7 +3439,7 @@ void GuiLoadStyle(const char *fileName)
imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageSize); imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageSize);
fread(imFont.data, 1, fontImageSize, rgsFile); fread(imFont.data, 1, fontImageSize, rgsFile);
if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture.id); if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture);
font.texture = LoadTextureFromImage(imFont); font.texture = LoadTextureFromImage(imFont);
if (font.texture.id == 0) font = GetFontDefault(); if (font.texture.id == 0) font = GetFontDefault();