diff options
| author | Ray <[email protected]> | 2016-12-05 01:14:18 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2016-12-05 01:14:18 +0100 |
| commit | 377dcb025fb6957f73263e1913dfc5f29ba21a58 (patch) | |
| tree | 0a2c8faaa47a09dd49567d9487fd518f75d50b41 /src/shapes.c | |
| parent | ab9f5d578025f71abd3b242170d6fb8ea6c2c297 (diff) | |
| download | raylib-377dcb025fb6957f73263e1913dfc5f29ba21a58.tar.gz raylib-377dcb025fb6957f73263e1913dfc5f29ba21a58.zip | |
Corrected some warnings
Diffstat (limited to 'src/shapes.c')
| -rw-r--r-- | src/shapes.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/shapes.c b/src/shapes.c index 70aad59a..3d3333c1 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -453,16 +453,17 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec) int recCenterX = rec.x + rec.width/2; int recCenterY = rec.y + rec.height/2; - float dx = fabs(center.x - recCenterX); - float dy = fabs(center.y - recCenterY); + float dx = fabsf(center.x - recCenterX); + float dy = fabsf(center.y - recCenterY); - if (dx > (rec.width/2 + radius)) { return false; } - if (dy > (rec.height/2 + radius)) { return false; } + if (dx > ((float)rec.width/2.0f + radius)) { return false; } + if (dy > ((float)rec.height/2.0f + radius)) { return false; } - if (dx <= (rec.width/2)) { return true; } - if (dy <= (rec.height/2)) { return true; } + if (dx <= ((float)rec.width/2.0f)) { return true; } + if (dy <= ((float)rec.height/2.0f)) { return true; } - float cornerDistanceSq = (dx - rec.width/2)*(dx - rec.width/2) + (dy - rec.height/2)*(dy - rec.height/2); + float cornerDistanceSq = (dx - (float)rec.width/2.0f)*(dx - (float)rec.width/2.0f) + + (dy - (float)rec.height/2.0f)*(dy - (float)rec.height/2.0f); return (cornerDistanceSq <= (radius*radius)); } |
