36 lines
481 B
C++
36 lines
481 B
C++
#include <cstdint>
|
|
#include <vector>
|
|
#include <list>
|
|
#include <raylib.h>
|
|
|
|
#include "values/Dna.hpp"
|
|
|
|
struct DrawArgs
|
|
{
|
|
Vector2 start;
|
|
float angleDeg;
|
|
float lenghth;
|
|
int dep;
|
|
};
|
|
|
|
class Tree
|
|
{
|
|
|
|
public:
|
|
Tree() = default;
|
|
~Tree() = default;
|
|
void init(int size);
|
|
void draw(Dna *dna);
|
|
bool tick();
|
|
|
|
private:
|
|
Dna *m_dna;
|
|
|
|
int size = 0;
|
|
Vector2 start = {0};
|
|
std::list<DrawArgs> draw_calls;
|
|
|
|
void generateBranches();
|
|
void drawBranch();
|
|
Vector2 drawLine();
|
|
}; |