restructure and add server/client example
This commit is contained in:
44
shared/inc/canvas/Tree.hpp
Normal file
44
shared/inc/canvas/Tree.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#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> drawCalls;
|
||||
|
||||
void drawBranch();
|
||||
|
||||
inline size_t getNumOfBranches(int dep);
|
||||
inline Color getStartColor(DrawArgs &arg);
|
||||
inline Color getEndColor(int dep, Color &start);
|
||||
inline int getStartSize(DrawArgs &arg);
|
||||
inline int getEndSize(DrawArgs &arg, int start);
|
||||
inline float getLength(DrawArgs &arg);
|
||||
inline float getAngleVar(DrawArgs &arg);
|
||||
};
|
Reference in New Issue
Block a user