treender/inc/canvas/Tree.hpp

43 lines
754 B
C++

#include <cstdint>
#include <vector>
#include <list>
#include <raylib.h>
#include "values/Dna.hpp"
struct DrawArgs
{
Vector2 start;
float angleDeg;
int dep;
Color parent;
int size;
};
class Tree
{
public:
Tree() = default;
~Tree() = default;
void init(int size);
void draw(Dna *dna);
bool tick();
private:
Dna *m_dna;
uint128 branchSeed;
int canvasSize = 0;
Vector2 start = {0};
std::list<DrawArgs> draw_calls;
void drawBranch();
inline int get_num_of_branches(int dep);
inline Color get_start_color(DrawArgs &arg);
inline Color get_end_color(int dep, Color &start);
inline int get_start_size(DrawArgs &arg);
inline int get_end_size(DrawArgs &arg, int start);
inline float get_lenght(DrawArgs &arg);
};