#pragma once #include #include "Singleton.h" namespace dae { class Texture2D; /** * Simple RAII wrapper for the SDL renderer */ class Renderer final : public Singleton { SDL_Renderer* m_renderer{}; SDL_Window* m_window{}; SDL_Color m_clearColor{}; public: void Init(SDL_Window* window); void Render() const; void Destroy(); void RenderTexture(const Texture2D& texture, float x, float y) const; void RenderTexture(const Texture2D& texture, const float x, const float y, const int width, const int height, const int srcX, const int srcY, bool isFlipped = false) const; void RenderTexture(const Texture2D& texture, float x, float y, float width, float height) const; SDL_Renderer* GetSDLRenderer() const; const SDL_Color& GetBackgroundColor() const { return m_clearColor; } void SetBackgroundColor(const SDL_Color& color) { m_clearColor = color; } }; }