Small changes in renderer design.

This commit is contained in:
BuildTools
2021-11-08 23:04:17 +01:00
parent dc1e910d23
commit ce7c79dade
5 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
///
/// TODO:
/// - Convertir los ptrs de los sistema UE a smart_pointers.
/// -
/// - Probablemente, eliminar el Singleton y hacer los ptrs static.
///
namespace UE
+2 -1
View File
@@ -2,6 +2,7 @@
namespace UE
{
class Renderer;
class Drawable
{
@@ -12,7 +13,7 @@ namespace UE
virtual ~Drawable() {};
public:
virtual DrawCall Draw() = 0;
virtual void Draw(Renderer* renderer) = 0;
};
+2 -2
View File
@@ -95,7 +95,7 @@ void UE::Renderer::QueueDrawCall(int layer, SDL_Texture* texture, SDL_Rect* posi
renderQueue.push_back(dc);
}
void UE::Renderer::QueueDrawable(Drawable* drawable)
void UE::Renderer::Render(Drawable& drawable)
{
renderQueue.push_back(drawable->Draw());
drawable.Draw(this);
}
+4 -1
View File
@@ -48,7 +48,10 @@ namespace UE
void QueueDrawCall(DrawCall drawCall);
void QueueDrawCall(int layer, SDL_Texture* texture, SDL_Rect* texture_position, SDL_Rect* position);
void QueueDrawCall(int layer, SDL_Texture* texture, SDL_Rect* position);
void QueueDrawable(Drawable* drawable);
//Le pasamos el este renderer al Drawable para que haga lo que quiera.
//Como si quiere usar el SDL_Renderer, es libre.
void Render(Drawable& drawable);
/* Get SDL Renderer. */
SDL_Renderer* GetSDLRenderer() { return main_Renderer; }
-1
View File
@@ -5,7 +5,6 @@
namespace UE
{
class Game;
class Sprite : public Drawable
{