summaryrefslogtreecommitdiffhomepage
path: root/src/shapes.c
diff options
context:
space:
mode:
authorRay <[email protected]>2020-02-28 12:54:39 +0100
committerRay <[email protected]>2020-02-28 12:54:39 +0100
commit1ee6290fcfebea2fa3a0a5a68c1c395974ebb436 (patch)
treeebab3b98439f1ae5d7c0a36c591cf50bf59d84a1 /src/shapes.c
parent572969d8b7889856bf59a470c5ffe56a2d14761f (diff)
downloadraylib-1ee6290fcfebea2fa3a0a5a68c1c395974ebb436.tar.gz
raylib-1ee6290fcfebea2fa3a0a5a68c1c395974ebb436.zip
Replaced fabs() by fabsf() when required
Diffstat (limited to 'src/shapes.c')
-rw-r--r--src/shapes.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/shapes.c b/src/shapes.c
index 4fb38867..02c0eeb7 100644
--- a/src/shapes.c
+++ b/src/shapes.c
@@ -42,8 +42,7 @@
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
-#include <stdlib.h> // Required for: fabs()
-#include <math.h> // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf()
+#include <math.h> // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf(), fabsf()
//----------------------------------------------------------------------------------
// Defines and Macros
@@ -1471,8 +1470,8 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
int recCenterX = (int)(rec.x + rec.width/2.0f);
int recCenterY = (int)(rec.y + rec.height/2.0f);
- float dx = (float)fabs(center.x - recCenterX);
- float dy = (float)fabs(center.y - recCenterY);
+ float dx = fabsf(center.x - (float)recCenterX);
+ float dy = fabsf(center.y - (float)recCenterY);
if (dx > (rec.width/2.0f + radius)) { return false; }
if (dy > (rec.height/2.0f + radius)) { return false; }
@@ -1493,8 +1492,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
if (CheckCollisionRecs(rec1, rec2))
{
- float dxx = (float)fabs(rec1.x - rec2.x);
- float dyy = (float)fabs(rec1.y - rec2.y);
+ float dxx = fabsf(rec1.x - rec2.x);
+ float dyy = fabsf(rec1.y - rec2.y);
if (rec1.x <= rec2.x)
{