Change to accept Color of the line to be drawn
This commit is contained in:
parent
24fee6498c
commit
2ae0839e4f
6
main.cpp
6
main.cpp
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user