Small changes in renderer design.
This commit is contained in:
@@ -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,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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
namespace UE
|
||||
{
|
||||
class Game;
|
||||
|
||||
class Sprite : public Drawable
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user