浏览代码

Update raygui.h

Ray 2 年之前
父节点
当前提交
7837b9dc06
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      src/raygui.h

+ 12 - 1
src/raygui.h

@@ -3548,7 +3548,18 @@ void GuiLoadStyleDefault(void)
     GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT, 8);
     GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW, 2);
 
-    guiFont = GetFontDefault();     // Initialize default font
+    if (guiFont.texture.id != GetFontDefault().texture.id)
+    {
+        // Unload previous font texture
+        UnloadTexture(guiFont.texture);
+
+        // Setup default raylib font
+        guiFont = GetFontDefault(); 
+
+        // Setup default raylib font rectangle
+        Rectangle whiteChar = { 41, 46, 2, 8 };
+        SetShapesTexture(guiFont.texture, whiteChar);
+    }
 }
 
 // Get text with icon id prepended