소스 검색

Update raygui.h

Ray 2 년 전
부모
커밋
328f46649b
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      src/raygui.h

+ 7 - 4
src/raygui.h

@@ -4048,7 +4048,8 @@ void GuiSetIconScale(int scale)
 // Module specific Functions Definition
 // Module specific Functions Definition
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
 
 
-// Load style from memory (binary only)
+// Load style from memory
+// WARNING: Binary files only
 static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize)
 static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize)
 {
 {
     unsigned char *fileDataPtr = (unsigned char *)fileData;
     unsigned char *fileDataPtr = (unsigned char *)fileData;
@@ -4103,7 +4104,6 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize)
         {
         {
             Font font = { 0 };
             Font font = { 0 };
             int fontType = 0;   // 0-Normal, 1-SDF
             int fontType = 0;   // 0-Normal, 1-SDF
-            Rectangle fontWhiteRec = { 0 };
 
 
             memcpy(&font.baseSize, fileDataPtr, sizeof(int));
             memcpy(&font.baseSize, fileDataPtr, sizeof(int));
             memcpy(&font.glyphCount, fileDataPtr + 4, sizeof(int));
             memcpy(&font.glyphCount, fileDataPtr + 4, sizeof(int));
@@ -4111,6 +4111,7 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize)
             fileDataPtr += 12;
             fileDataPtr += 12;
 
 
             // Load font white rectangle
             // Load font white rectangle
+            Rectangle fontWhiteRec = { 0 };
             memcpy(&fontWhiteRec, fileDataPtr, sizeof(Rectangle));
             memcpy(&fontWhiteRec, fileDataPtr, sizeof(Rectangle));
             fileDataPtr += 16;
             fileDataPtr += 16;
 
 
@@ -4180,8 +4181,10 @@ static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize)
 
 
             // Set font texture source rectangle to be used as white texture to draw shapes
             // Set font texture source rectangle to be used as white texture to draw shapes
             // NOTE: It makes possible to draw shapes and text (full UI) in a single draw call
             // NOTE: It makes possible to draw shapes and text (full UI) in a single draw call
-            if ((fontWhiteRec.x > 0) && (fontWhiteRec.y > 0) && 
-                (fontWhiteRec.width > 0) && (fontWhiteRec.height > 0)) SetShapesTexture(font.texture, fontWhiteRec);
+            if ((fontWhiteRec.x > 0) && 
+                (fontWhiteRec.y > 0) && 
+                (fontWhiteRec.width > 0) && 
+                (fontWhiteRec.height > 0)) SetShapesTexture(font.texture, fontWhiteRec);
         }
         }
 #endif
 #endif
     }
     }