|
|
@ -393,14 +393,14 @@ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endA |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
rlTexCoord2f(p">(texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*p">(angle + stepLength*2))*radius, center.y + sinf(DEG2RAD*p">(angle + stepLength*2))*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*radius, center.y + cosf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*radius, center.y + sinf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
|
|
|
|
rlTexCoord2f(p">(texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*p">(angle + stepLength*2))*radius, center.y + cosf(DEG2RAD*p">(angle + stepLength*2))*radius); |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
|
|
|
|
angle += (stepLength*2); |
|
|
|
} |
|
|
@ -413,11 +413,11 @@ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endA |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*radius, center.y + cosf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*radius, center.y + sinf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
@ -432,8 +432,8 @@ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endA |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*p">(angle + stepLength))*radius, center.y + cosf(DEG2RAD*p">(angle + stepLength))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*p">(angle + stepLength))*radius, center.y + sinf(DEG2RAD*p">(angle + stepLength))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
|
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
@ -475,15 +475,15 @@ void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; i < segments; i++) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*radius, center.y + cosf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*radius, center.y + sinf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
|
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
@ -492,7 +492,7 @@ void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
} |
|
|
@ -507,9 +507,9 @@ void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Co |
|
|
|
rlColor4ub(color1.r, color1.g, color1.b, color1.a); |
|
|
|
rlVertex2f((float)centerX, (float)centerY); |
|
|
|
rlColor4ub(color2.r, color2.g, color2.b, color2.a); |
|
|
|
rlVertex2f((float)centerX + sinf(DEG2RAD*i)*radius, (float)centerY + cosf(DEG2RAD*i)*radius); |
|
|
|
rlVertex2f((float)centerX + cosf(DEG2RAD*p">(i + 10))*radius, (float)centerY + sinf(DEG2RAD*p">(i + 10))*radius); |
|
|
|
rlColor4ub(color2.r, color2.g, color2.b, color2.a); |
|
|
|
rlVertex2f((float)centerX + sinf(DEG2RAD*p">(i + 10))*radius, (float)centerY + cosf(DEG2RAD*p">(i + 10))*radius); |
|
|
|
rlVertex2f((float)centerX + cosf(DEG2RAD*i)*radius, (float)centerY + sinf(DEG2RAD*i)*radius); |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
} |
|
|
@ -530,8 +530,8 @@ void DrawCircleLines(int centerX, int centerY, float radius, Color color) |
|
|
|
// NOTE: Circle outline is drawn pixel by pixel every degree (0 to 360) |
|
|
|
for (int i = 0; i < 360; i += 10) |
|
|
|
{ |
|
|
|
rlVertex2f(centerX + sinf(DEG2RAD*i)*radius, centerY + cosf(DEG2RAD*i)*radius); |
|
|
|
rlVertex2f(centerX + sinf(DEG2RAD*(i + 10))*radius, centerY + cosf(DEG2RAD*(i + 10))*radius); |
|
|
|
rlVertex2f(centerX + cosf(DEG2RAD*i)*radius, centerY + sinf(DEG2RAD*i)*radius); |
|
|
|
rlVertex2f(centerX + cosf(DEG2RAD*(i + 10))*radius, centerY + sinf(DEG2RAD*(i + 10))*radius); |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
} |
|
|
@ -544,8 +544,8 @@ void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color c |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlVertex2f((float)centerX, (float)centerY); |
|
|
|
rlVertex2f((float)centerX + sinf(DEG2RAD*i)*radiusH, (float)centerY + cosf(DEG2RAD*i)*radiusV); |
|
|
|
rlVertex2f((float)centerX + sinf(DEG2RAD*p">(i + 10))*radiusH, (float)centerY + cosf(DEG2RAD*p">(i + 10))*radiusV); |
|
|
|
rlVertex2f((float)centerX + cosf(DEG2RAD*p">(i + 10))*radiusH, (float)centerY + sinf(DEG2RAD*p">(i + 10))*radiusV); |
|
|
|
rlVertex2f((float)centerX + cosf(DEG2RAD*i)*radiusH, (float)centerY + sinf(DEG2RAD*i)*radiusV); |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
} |
|
|
@ -557,8 +557,8 @@ void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Co |
|
|
|
for (int i = 0; i < 360; i += 10) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlVertex2f(centerX + sinf(DEG2RAD*i)*radiusH, centerY + cosf(DEG2RAD*i)*radiusV); |
|
|
|
rlVertex2f(centerX + sinf(DEG2RAD*p">(i + 10))*radiusH, centerY + cosf(DEG2RAD*p">(i + 10))*radiusV); |
|
|
|
rlVertex2f(centerX + cosf(DEG2RAD*p">(i + 10))*radiusH, centerY + sinf(DEG2RAD*p">(i + 10))*radiusV); |
|
|
|
rlVertex2f(centerX + cosf(DEG2RAD*i)*radiusH, centerY + sinf(DEG2RAD*i)*radiusV); |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
} |
|
|
@ -616,17 +616,17 @@ void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startA |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*innerRadius, center.y + cosf(DEG2RAD*angle)*innerRadius); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
|
|
|
|
rlTexCoord2f(p">(texShapesRec.x + texShapesRec.width)/texShapes.width, p">(texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*p">(angle + stepLength))*outerRadius, center.y + cosf(DEG2RAD*p">(angle + stepLength))*outerRadius); |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*innerRadius, center.y + sinf(DEG2RAD*angle)*innerRadius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + cosf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*outerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*outerRadius); |
|
|
|
|
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
@ -639,13 +639,13 @@ void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startA |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*innerRadius, center.y + cosf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*p">(angle + stepLength))*innerRadius, center.y + cosf(DEG2RAD*p">(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*innerRadius, center.y + sinf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*p">(angle + stepLength))*innerRadius, center.y + sinf(DEG2RAD*p">(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + cosf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*p">(angle + stepLength))*outerRadius, center.y + cosf(DEG2RAD*p">(angle + stepLength))*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*p">(angle + stepLength))*outerRadius, center.y + sinf(DEG2RAD*p">(angle + stepLength))*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
|
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
@ -702,19 +702,19 @@ void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float s |
|
|
|
if (showCapLines) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*innerRadius, center.y + cosf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*innerRadius, center.y + sinf(DEG2RAD*angle)*innerRadius); |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; i < segments; i++) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*outerRadius, center.y + cosf(DEG2RAD*(angle + stepLength))*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*outerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*outerRadius); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*innerRadius, center.y + cosf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + cosf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*innerRadius, center.y + sinf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
|
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
@ -722,8 +722,8 @@ void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float s |
|
|
|
if (showCapLines) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*innerRadius, center.y + cosf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*innerRadius, center.y + sinf(DEG2RAD*angle)*innerRadius); |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
} |
|
|
@ -982,7 +982,7 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co |
|
|
|
}; |
|
|
|
|
|
|
|
const Vector2 centers[4] = { point[8], point[9], point[10], point[11] }; |
|
|
|
const float angles[4] = { 180.0f, 90.0f, 0.0f, 270.0f }; |
|
|
|
const float angles[4] = { 180.0f, 270.0f, 0.0f, 90.0f }; |
|
|
|
|
|
|
|
#if defined(SUPPORT_QUADS_DRAW_MODE) |
|
|
|
rlSetTexture(texShapes.id); |
|
|
@ -1000,12 +1000,16 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*radius, center.y + cosf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength*2))*radius, center.y + cosf(DEG2RAD*(angle + stepLength*2))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength*2))*radius, center.y + sinf(DEG2RAD*(angle + stepLength*2))*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*radius, center.y + sinf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
|
|
|
|
angle += (stepLength*2); |
|
|
|
} |
|
|
|
|
|
|
@ -1015,10 +1019,13 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*radius, center.y + cosf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*radius, center.y + sinf(DEG2RAD*(angle + stepLength))*radius); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
} |
|
|
@ -1093,8 +1100,8 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*radius, center.y + cosf(DEG2RAD*angle)*radius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*p">(angle + stepLength))*radius, center.y + cosf(DEG2RAD*p">(angle + stepLength))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*p">(angle + stepLength))*radius, center.y + sinf(DEG2RAD*p">(angle + stepLength))*radius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*radius, center.y + sinf(DEG2RAD*angle)*radius); |
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
|
} |
|
|
@ -1208,7 +1215,7 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo |
|
|
|
{(float)(rec.x + rec.width) - innerRadius, (float)(rec.y + rec.height) - innerRadius}, {(float)rec.x + innerRadius, (float)(rec.y + rec.height) - innerRadius} // P18, P19 |
|
|
|
}; |
|
|
|
|
|
|
|
const float angles[4] = { 180.0f, 90.0f, 0.0f, 270.0f }; |
|
|
|
const float angles[4] = { 180.0f, 270.0f, 0.0f, 90.0f }; |
|
|
|
|
|
|
|
if (lineThick > 1) |
|
|
|
{ |
|
|
@ -1225,14 +1232,18 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo |
|
|
|
for (int i = 0; i < segments; i++) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*innerRadius, center.y + cosf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*outerRadius, center.y + cosf(DEG2RAD*(angle + stepLength))*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*innerRadius, center.y + sinf(DEG2RAD*angle)*innerRadius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + cosf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*outerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*outerRadius); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
|
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
@ -1297,13 +1308,13 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*innerRadius, center.y + cosf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*p">(angle + stepLength))*innerRadius, center.y + cosf(DEG2RAD*p">(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*innerRadius, center.y + sinf(DEG2RAD*angle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*p">(angle + stepLength))*innerRadius, center.y + sinf(DEG2RAD*p">(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + cosf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*p">(angle + stepLength))*outerRadius, center.y + cosf(DEG2RAD*p">(angle + stepLength))*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*innerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*p">(angle + stepLength))*outerRadius, center.y + sinf(DEG2RAD*p">(angle + stepLength))*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
|
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
@ -1361,8 +1372,8 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo |
|
|
|
for (int i = 0; i < segments; i++) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*angle)*outerRadius, center.y + cosf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*(angle + stepLength))*outerRadius, center.y + cosf(DEG2RAD*(angle + stepLength))*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius); |
|
|
|
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*outerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*outerRadius); |
|
|
|
angle += stepLength; |
|
|
|
} |
|
|
|
} |
|
|
@ -1492,7 +1503,8 @@ void DrawTriangleStrip(Vector2 *points, int pointCount, Color color) |
|
|
|
void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color) |
|
|
|
{ |
|
|
|
if (sides < 3) sides = 3; |
|
|
|
float centralAngle = rotation; |
|
|
|
float centralAngle = rotation*DEG2RAD; |
|
|
|
float angleStep = 360.0f/(float)sides*DEG2RAD; |
|
|
|
|
|
|
|
#if defined(SUPPORT_QUADS_DRAW_MODE) |
|
|
|
rlSetTexture(texShapes.id); |
|
|
@ -1501,19 +1513,21 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col |
|
|
|
for (int i = 0; i < sides; i++) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
float nextAngle = centralAngle + angleStep; |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*radius, center.y + sinf(centralAngle)*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(nextAngle)*radius, center.y + sinf(nextAngle)*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*radius, center.y + sinf(centralAngle)*radius); |
|
|
|
|
|
|
|
centralAngle += 360.0f/(float)sides; |
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
centralAngle = nextAngle; |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
rlSetTexture(0); |
|
|
@ -1524,10 +1538,10 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlVertex2f(center.x, center.y); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle + angleStep)*radius, center.y + sinf(centralAngle + angleStep)*radius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*radius, center.y + sinf(centralAngle)*radius); |
|
|
|
|
|
|
|
centralAngle += 360.0f/(float)sides; |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
centralAngle += angleStep; |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
#endif |
|
|
@ -1537,16 +1551,18 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col |
|
|
|
void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color) |
|
|
|
{ |
|
|
|
if (sides < 3) sides = 3; |
|
|
|
float centralAngle = rotation; |
|
|
|
float centralAngle = rotation*DEG2RAD; |
|
|
|
float angleStep = 360.0f/(float)sides*DEG2RAD; |
|
|
|
|
|
|
|
rlBegin(RL_LINES); |
|
|
|
for (int i = 0; i < sides; i++) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
centralAngle += 360.0f/(float)sides; |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*radius, center.y + sinf(centralAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle + angleStep)*radius, center.y + sinf(centralAngle + angleStep)*radius); |
|
|
|
|
|
|
|
centralAngle += angleStep; |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
} |
|
|
@ -1554,8 +1570,8 @@ void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Colo |
|
|
|
void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color) |
|
|
|
{ |
|
|
|
if (sides < 3) sides = 3; |
|
|
|
float centralAngle = rotation; |
|
|
|
float exteriorAngle = 360.0f/(float)sides; |
|
|
|
float centralAngle = rotationo">*DEG2RAD; |
|
|
|
float exteriorAngle = 360.0f/(float)sideso">*DEG2RAD; |
|
|
|
float innerRadius = radius - (lineThick*cosf(DEG2RAD*exteriorAngle/2.0f)); |
|
|
|
|
|
|
|
#if defined(SUPPORT_QUADS_DRAW_MODE) |
|
|
@ -1565,19 +1581,21 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl |
|
|
|
for (int i = 0; i < sides; i++) |
|
|
|
{ |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
float nextAngle = centralAngle + exteriorAngle; |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*radius, center.y + sinf(centralAngle)*radius); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*innerRadius, center.y + cosf(DEG2RAD*centralAngle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*innerRadius, center.y + sinf(centralAngle)*innerRadius); |
|
|
|
|
|
|
|
rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
rlTexCoord2f(p">(texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + cosf(nextAngle)*innerRadius, center.y + sinf(nextAngle)*innerRadius); |
|
|
|
|
|
|
|
centralAngle += exteriorAngle; |
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(nextAngle)*radius, center.y + sinf(nextAngle)*radius); |
|
|
|
|
|
|
|
rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*innerRadius, center.y + cosf(DEG2RAD*centralAngle)*innerRadius); |
|
|
|
centralAngle = nextAngle; |
|
|
|
} |
|
|
|
rlEnd(); |
|
|
|
rlSetTexture(0); |
|
|
@ -1588,13 +1606,13 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl |
|
|
|
rlColor4ub(color.r, color.g, color.b, color.a); |
|
|
|
float nextAngle = centralAngle + exteriorAngle; |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*radius, center.y + cosf(DEG2RAD*centralAngle)*radius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*innerRadius, center.y + cosf(DEG2RAD*centralAngle)*innerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*nextAngle)*radius, center.y + cosf(DEG2RAD*nextAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(nextAngle)*radius, center.y + sinf(nextAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*radius, center.y + sinf(centralAngle)*radius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*innerRadius, center.y + sinf(centralAngle)*innerRadius); |
|
|
|
|
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*centralAngle)*innerRadius, center.y + cosf(DEG2RAD*centralAngle)*innerRadius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*nextAngle)*radius, center.y + cosf(DEG2RAD*nextAngle)*radius); |
|
|
|
rlVertex2f(center.x + sinf(DEG2RAD*nextAngle)*innerRadius, center.y + cosf(DEG2RAD*nextAngle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(centralAngle)*innerRadius, center.y + sinf(centralAngle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(nextAngle)*innerRadius, center.y + sinf(nextAngle)*innerRadius); |
|
|
|
rlVertex2f(center.x + cosf(nextAngle)*radius, center.y + sinf(nextAngle)*radius); |
|
|
|
|
|
|
|
centralAngle = nextAngle; |
|
|
|
} |
|
|
|