|
|
@ -154,7 +154,7 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color) |
|
|
|
{ |
|
|
|
// Cubic easing in-out |
|
|
|
// 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(p">(float)i, startPos.y, endPos.y - startPos.y, (float) LINE_DIVISIONS); |
|
|
|
current.x = previous.x + (endPos.x - startPos.x)/ (float) LINE_DIVISIONS; |
|
|
|
|
|
|
|
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(rec.width > rec.height) lineThick = rec.height/2; |
|
|
|
else if (rec.width < rec.height) lineThick = rec.width/2; |
|
|
|
if(rec.width > rec.height) lineThick = p">(int)rec.height/2; |
|
|
|
else if (rec.width < rec.height) lineThick = p">(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*i">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, p">(int)rec.y, (int)rec.width, lineThick, color); |
|
|
|
DrawRectangle( (int)(rec.x - lineThick + rec.width), p">(int)(rec.y + lineThick), lineThick, p">(int)(rec.height - lineThick*f">2.0f), color); |
|
|
|
DrawRectangle( (int)rec.x, p">(int)(rec.y + rec.height - lineThick), (int)rec.width, lineThick, color); |
|
|
|
DrawRectangle( (int)rec.x, p">(int)(rec.y + lineThick), lineThick, p">(int)(rec.height - lineThick*2), color); |
|
|
|
} |
|
|
|
|
|
|
|
// Draw a triangle |
|
|
@ -648,8 +648,8 @@ bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2) |
|
|
|
{ |
|
|
|
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 = p">(float)fabs((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2)); |
|
|
|
float dy = p">(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; |
|
|
|
|
|
|
@ -675,11 +675,11 @@ bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, floa |
|
|
|
// NOTE: Reviewed version to take into account corner limit case |
|
|
|
bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec) |
|
|
|
{ |
|
|
|
int recCenterX = rec.x + rec.width/i">2; |
|
|
|
int recCenterY = rec.y + rec.height/i">2; |
|
|
|
int recCenterX = p">(int)(rec.x + rec.width/f">2.0f); |
|
|
|
int recCenterY = p">(int)(rec.y + rec.height/f">2.0f); |
|
|
|
|
|
|
|
float dx = fabs(center.x - recCenterX); |
|
|
|
float dy = fabs(center.y - recCenterY); |
|
|
|
float dx = p">(float)fabs(center.x - recCenterX); |
|
|
|
float dy = p">(float)fabs(center.y - recCenterY); |
|
|
|
|
|
|
|
if (dx > (rec.width/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)) |
|
|
|
{ |
|
|
|
float dxx = fabs(rec1.x - rec2.x); |
|
|
|
float dyy = fabs(rec1.y - rec2.y); |
|
|
|
float dxx = p">(float)fabs(rec1.x - rec2.x); |
|
|
|
float dyy = p">(float)fabs(rec1.y - rec2.y); |
|
|
|
|
|
|
|
if (rec1.x <= rec2.x) |
|
|
|
{ |
|
|
@ -768,8 +768,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2) |
|
|
|
// NOTE: Required for DrawLineBezier() |
|
|
|
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; |
|
|
|
return 0.5*c*(t*t*t + i">2) + b; |
|
|
|
return 0.5f*c*(t*t*t + f">2.0f) + b; |
|
|
|
} |