Change to accept Color of the line to be drawn

This commit is contained in:
Nikola Petrov 2024-02-21 22:19:44 +01:00
parent 24fee6498c
commit 2ae0839e4f

View File

@ -4,20 +4,20 @@
#define MAX_DEPTH 10
Vector2 draw_line(Vector2 start, float angleDeg, float lenghth)
Vector2 draw_line(Vector2 start, float angleDeg, float lenghth, Color color)
{
angleDeg += 180.0f;
float angle = (angleDeg * PI) / 180.0f;
float nx = lenghth * std::sin(angle);
float ny = lenghth * std::cos(angle);
Vector2 end = {start.x + nx, start.y + ny};
DrawLineEx(start, end, 2.0f, PURPLE);
DrawLineEx(start, end, 2.0f, color);
return end;
}
void draw_branch(Vector2 start, float angle, float len, int dep)
{
Vector2 next = draw_line(start, angle, len);
Vector2 next = draw_line(start, angle, len, PURPLE);
if (len < MAX_DEPTH)
return;