Add Canvas
Canvas contains the RenderTexture2D contains the Tree and now it's eazy to add more modules
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <vector>
|
||||
#include "Tree.hpp"
|
||||
#include "Canvas.hpp"
|
||||
|
||||
class App
|
||||
{
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
private:
|
||||
int pos = 0;
|
||||
int screenWidth, screenHeight;
|
||||
std::vector<Tree> trees;
|
||||
std::vector<Canvas> canvases;
|
||||
Vector2 center;
|
||||
float rotation = 0.0f;
|
||||
Rectangle destB;
|
||||
|
18
inc/Canvas.hpp
Normal file
18
inc/Canvas.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "raylib.h"
|
||||
#include "Tree.hpp"
|
||||
|
||||
class Canvas
|
||||
{
|
||||
|
||||
public:
|
||||
Canvas() = default;
|
||||
~Canvas() = default;
|
||||
void init(int size);
|
||||
void newGen();
|
||||
void draw(Rectangle dest, float rotation);
|
||||
void deinit();
|
||||
|
||||
private:
|
||||
Tree tree;
|
||||
RenderTexture2D target = {0};
|
||||
};
|
10
inc/Tree.hpp
10
inc/Tree.hpp
@@ -24,15 +24,13 @@ class Tree
|
||||
{
|
||||
|
||||
public:
|
||||
Tree(int size);
|
||||
~Tree();
|
||||
void draw(Rectangle dest, float rotation);
|
||||
void newTree();
|
||||
void deinit();
|
||||
Tree() = default;
|
||||
~Tree() = default;
|
||||
void init(int size);
|
||||
void newGen();
|
||||
|
||||
private:
|
||||
int size = 0;
|
||||
RenderTexture2D target = {0};
|
||||
Vector2 start = {0};
|
||||
std::vector<Branch> branches;
|
||||
std::list<DrawArgs> draw_calls;
|
||||
|
Reference in New Issue
Block a user