treender/inc/canvas/Tree.hpp
2024-12-30 21:53:13 +01:00

40 lines
626 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;
Color parent;
};
class Tree
{
public:
Tree() = default;
~Tree() = default;
void init(int size);
void draw(Dna *dna);
bool tick();
private:
Dna *m_dna;
uint128 branchSeed;
int size = 0;
Vector2 start = {0};
std::list<DrawArgs> draw_calls;
void drawBranch();
inline uint8_t get_num_of_branches(uint8_t dep);
inline Color get_start_color(DrawArgs &arg);
inline Color get_end_color(uint8_t dep, Color &start);
};