Jelajahi Sumber

Converting int to char

Fixes warning: narrowing conversion caused by trying to convert int to unsigned char
Aidon 6 bulan lalu
induk
melakukan
513753c394
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 5 1
      examples/core/core_2d_camera.c

+ 5 - 1
examples/core/core_2d_camera.c

@@ -44,7 +44,11 @@ int main(void)
 
         spacing += (int)buildings[i].width;
 
-        buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
+        buildColors[i] = (Color){
+            (unsigned char)GetRandomValue(200, 240),
+            (unsigned char)GetRandomValue(200, 240),
+            (unsigned char)GetRandomValue(200, 250),
+            255};
     }
 
     Camera2D camera = { 0 };