summaryrefslogtreecommitdiffhomepage
path: root/src/shapes.c
diff options
context:
space:
mode:
authorRay <[email protected]>2021-06-10 18:00:44 +0200
committerRay <[email protected]>2021-06-10 18:00:44 +0200
commitb188008a1c746abf1c086a00708a447c1abbb19b (patch)
treea838d6b606d86275e904cd036b4d2ae312c06d27 /src/shapes.c
parent7bc2e922c9a04e9a1bb54088522e0f318feeb17c (diff)
downloadraylib-b188008a1c746abf1c086a00708a447c1abbb19b.tar.gz
raylib-b188008a1c746abf1c086a00708a447c1abbb19b.zip
Review code formatting
Diffstat (limited to 'src/shapes.c')
-rw-r--r--src/shapes.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/shapes.c b/src/shapes.c
index 5ed7acbb..5acd9810 100644
--- a/src/shapes.c
+++ b/src/shapes.c
@@ -122,15 +122,19 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
// Draw a line defining thickness
void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
{
- Vector2 delta = {endPos.x-startPos.x, endPos.y-startPos.y};
- float length = sqrtf(delta.x*delta.x + delta.y*delta.y);
+ Vector2 delta = { endPos.x - startPos.x, endPos.y - startPos.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);
- 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},
- {endPos.x-radius.x, endPos.y-radius.y}, {endPos.x+radius.x, endPos.y+radius.y}};
+ float scale = thick/(2*length);
+ Vector2 radius = { -scale*delta.y, scale*delta.x };
+ Vector2 strip[4] = {
+ { 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);
}