Browse Source

Fix compiler warnings of lib

Kim Kulling 7 years ago
parent
commit
f5f7ed79b8
3 changed files with 22 additions and 22 deletions
  1. 2 2
      src/camera.h
  2. 2 2
      src/rlgl.h
  3. 18 18
      src/shapes.c

+ 2 - 2
src/camera.h

@@ -244,8 +244,8 @@ void SetCameraMode(Camera camera, int mode)
     distance.y = sqrtf(dx*dx + dy*dy);
     distance.y = sqrtf(dx*dx + dy*dy);
     
     
     // Camera angle calculation
     // Camera angle calculation
-    cameraAngle.x = (float)asinf(fabs(dx)/distance.x);  // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
-    cameraAngle.y = (float)-asinf(fabs(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
+    cameraAngle.x = asinf( (float)fabs(dx)/distance.x);  // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
+    cameraAngle.y = -asinf( (float)fabs(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
     
     
     // NOTE: Just testing what cameraAngle means
     // NOTE: Just testing what cameraAngle means
     //cameraAngle.x = 0.0f*DEG2RAD;       // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
     //cameraAngle.x = 0.0f*DEG2RAD;       // Camera angle in plane XZ (0 aligned with Z, move positive CCW)

+ 2 - 2
src/rlgl.h

@@ -3306,8 +3306,8 @@ Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size)
     for (unsigned int mip = 0; mip < MAX_MIPMAP_LEVELS; mip++)
     for (unsigned int mip = 0; mip < MAX_MIPMAP_LEVELS; mip++)
     {
     {
         // Resize framebuffer according to mip-level size.
         // Resize framebuffer according to mip-level size.
-        unsigned int mipWidth  = size*(int) powf(0.5f, mip);
-        unsigned int mipHeight = size* (int) powf(0.5f, mip);
+        unsigned int mipWidth  = size*(int) powf(0.5f, (float) mip);
+        unsigned int mipHeight = size* (int) powf(0.5f, (float) mip);
 
 
         glBindRenderbuffer(GL_RENDERBUFFER, rbo);
         glBindRenderbuffer(GL_RENDERBUFFER, rbo);
         glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight);
         glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight);

+ 18 - 18
src/shapes.c

@@ -154,7 +154,7 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
     {
     {
         // Cubic easing in-out
         // Cubic easing in-out
         // NOTE: Easing is calculated only for y position value 
         // NOTE: Easing is calculated only for y position value 
-        current.y = EaseCubicInOut(i, startPos.y, endPos.y - startPos.y, (float) LINE_DIVISIONS);
+        current.y = EaseCubicInOut((float)i, startPos.y, endPos.y - startPos.y, (float) LINE_DIVISIONS);
         current.x = previous.x + (endPos.x - startPos.x)/ (float) LINE_DIVISIONS;
         current.x = previous.x + (endPos.x - startPos.x)/ (float) LINE_DIVISIONS;
         
         
         DrawLineEx(previous, current, thick, color);
         DrawLineEx(previous, current, thick, color);
@@ -457,14 +457,14 @@ void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color)
 {   
 {   
     if (lineThick > rec.width || lineThick > rec.height)
     if (lineThick > rec.width || lineThick > rec.height)
     {
     {
-        if(rec.width > rec.height) lineThick = rec.height/2;
-        else if (rec.width < rec.height) lineThick = rec.width/2;
+        if(rec.width > rec.height) lineThick = (int)rec.height/2;
+        else if (rec.width < rec.height) lineThick = (int)rec.width/2;
     }        
     }        
     
     
-    DrawRectangle(rec.x, rec.y, rec.width, lineThick, color);
-    DrawRectangle(rec.x - lineThick + rec.width, rec.y + lineThick, lineThick, rec.height - lineThick*2, color);
-    DrawRectangle(rec.x, rec.y + rec.height - lineThick, rec.width, lineThick, color);
-    DrawRectangle(rec.x, rec.y + lineThick, lineThick, rec.height - lineThick*2, color);
+    DrawRectangle( (int)rec.x, (int)rec.y, (int)rec.width, lineThick, color);
+    DrawRectangle( (int)(rec.x - lineThick + rec.width), (int)(rec.y + lineThick), lineThick, (int)(rec.height - lineThick*2.0f), color);
+    DrawRectangle( (int)rec.x, (int)(rec.y + rec.height - lineThick), (int)rec.width, lineThick, color);
+    DrawRectangle( (int)rec.x, (int)(rec.y + lineThick), lineThick, (int)(rec.height - lineThick*2), color);
 }
 }
 
 
 // Draw a triangle
 // Draw a triangle
@@ -648,8 +648,8 @@ bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2)
 {
 {
     bool collision = false;
     bool collision = false;
 
 
-    float dx = fabs((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
-    float dy = fabs((rec1.y + rec1.height/2) - (rec2.y + rec2.height/2));
+    float dx = (float)fabs((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
+    float dy = (float)fabs((rec1.y + rec1.height/2) - (rec2.y + rec2.height/2));
 
 
     if ((dx <= (rec1.width/2 + rec2.width/2)) && ((dy <= (rec1.height/2 + rec2.height/2)))) collision = true;
     if ((dx <= (rec1.width/2 + rec2.width/2)) && ((dy <= (rec1.height/2 + rec2.height/2)))) collision = true;
 
 
@@ -675,11 +675,11 @@ bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, floa
 // NOTE: Reviewed version to take into account corner limit case
 // NOTE: Reviewed version to take into account corner limit case
 bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
 bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
 {
 {
-    int recCenterX = rec.x + rec.width/2;
-    int recCenterY = rec.y + rec.height/2;
+    int recCenterX = (int)(rec.x + rec.width/2.0f);
+    int recCenterY = (int)(rec.y + rec.height/2.0f);
     
     
-    float dx = fabs(center.x - recCenterX);
-    float dy = fabs(center.y - recCenterY);
+    float dx = (float)fabs(center.x - recCenterX);
+    float dy = (float)fabs(center.y - recCenterY);
 
 
     if (dx > (rec.width/2.0f + radius)) { return false; }
     if (dx > (rec.width/2.0f + radius)) { return false; }
     if (dy > (rec.height/2.0f + radius)) { return false; }
     if (dy > (rec.height/2.0f + radius)) { return false; }
@@ -700,8 +700,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
 
 
     if (CheckCollisionRecs(rec1, rec2))
     if (CheckCollisionRecs(rec1, rec2))
     {
     {
-        float dxx = fabs(rec1.x - rec2.x);
-        float dyy = fabs(rec1.y - rec2.y);
+        float dxx = (float)fabs(rec1.x - rec2.x);
+        float dyy = (float)fabs(rec1.y - rec2.y);
 
 
         if (rec1.x <= rec2.x)
         if (rec1.x <= rec2.x)
         {
         {
@@ -768,8 +768,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
 // NOTE: Required for DrawLineBezier()
 // NOTE: Required for DrawLineBezier()
 static float EaseCubicInOut(float t, float b, float c, float d) 
 static float EaseCubicInOut(float t, float b, float c, float d) 
 { 
 { 
-    if ((t /= 0.5*d) < 1)
-        return 0.5*c*t*t*t + b;
+    if ((t /= 0.5f*d) < 1)
+        return 0.5f*c*t*t*t + b;
     t -= 2;
     t -= 2;
-    return 0.5*c*(t*t*t + 2) + b;
+    return 0.5f*c*(t*t*t + 2.0f) + b;
 }
 }