Extract RenderTexture from Canvas

For easyer managment of texures and potential buffers
This commit is contained in:
Nikola Petrov
2024-08-12 22:39:52 +02:00
parent 2f4ad253a1
commit d7afa1afc9
6 changed files with 27 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
#include <vector>
#include <array>
#include "canvas/Canvas.hpp"
class App
@@ -15,7 +15,8 @@ public:
private:
int pos = 0;
int screenWidth, screenHeight;
std::vector<Canvas> canvases;
Canvas canvas;
std::array< RenderTexture2D, 2> canvasTexure = { 0 };
float rotation = 0.0f;
Rectangle destB;
Rectangle destA;

View File

@@ -3,4 +3,6 @@
Color ColorLerp(Color c1, Color c2, float amount);
Color ColorAdd(Color c, int add);
Vector2 CalculateVector(float rotation, float offSet, float len);
float GetRandomFloat();
float GetRandomFloat();
void drawTexureWithRotation(RenderTexture2D& target, Rectangle& dest, float rotation);

View File

@@ -9,12 +9,9 @@ public:
Canvas() = default;
~Canvas() = default;
void init(int size);
void newGen();
void draw(Rectangle dest, float rotation);
void deinit();
void newGen(RenderTexture2D& target);
private:
BackGround backGround;
Tree tree;
RenderTexture2D target = {0};
};