mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-05 05:39:18 -05:00
Review code formatting
This commit is contained in:
10
src/shapes.c
10
src/shapes.c
@ -125,12 +125,16 @@ void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
|
|||||||
Vector2 delta = { endPos.x - startPos.x, endPos.y - startPos.y };
|
Vector2 delta = { endPos.x - startPos.x, endPos.y - startPos.y };
|
||||||
float length = sqrtf(delta.x*delta.x + delta.y*delta.y);
|
float length = sqrtf(delta.x*delta.x + delta.y*delta.y);
|
||||||
|
|
||||||
if (length > 0 && thick > 0)
|
if ((length > 0) && (thick > 0))
|
||||||
{
|
{
|
||||||
float scale = thick/(2*length);
|
float scale = thick/(2*length);
|
||||||
Vector2 radius = { -scale*delta.y, scale*delta.x };
|
Vector2 radius = { -scale*delta.y, scale*delta.x };
|
||||||
Vector2 strip[] = {{startPos.x-radius.x, startPos.y-radius.y}, {startPos.x+radius.x, startPos.y+radius.y},
|
Vector2 strip[4] = {
|
||||||
{endPos.x-radius.x, endPos.y-radius.y}, {endPos.x+radius.x, endPos.y+radius.y}};
|
{ startPos.x - radius.x, startPos.y - radius.y },
|
||||||
|
{ startPos.x + radius.x, startPos.y + radius.y },
|
||||||
|
{ endPos.x - radius.x, endPos.y - radius.y },
|
||||||
|
{ endPos.x + radius.x, endPos.y + radius.y }
|
||||||
|
};
|
||||||
|
|
||||||
DrawTriangleStrip(strip, 4, color);
|
DrawTriangleStrip(strip, 4, color);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user