diff --git a/SDL2pp/Renderer.cc b/SDL2pp/Renderer.cc index f164bf9..1ad5d78 100644 --- a/SDL2pp/Renderer.cc +++ b/SDL2pp/Renderer.cc @@ -56,11 +56,6 @@ SDL_Renderer* Renderer::Get() const { return renderer_; } -void Renderer::SetLogicalSize(int w, int h) { - if (SDL_RenderSetLogicalSize(renderer_, w, h) != 0) - throw Exception("SDL_RenderSetLogicalSize failed"); -} - void Renderer::Present() { SDL_RenderPresent(renderer_); } @@ -214,4 +209,28 @@ void Renderer::ReadPixels(const Rect& rect, Uint32 format, void* pixels, int pit throw Exception("SDL_RenderReadPixels failed"); } +void Renderer::SetClipRect(const Rect& rect) { + if (SDL_RenderSetClipRect(renderer_, rect.Get()) != 0) + throw Exception("SDL_RenderSetClipRect failed"); +} + +void Renderer::SetLogicalSize(int w, int h) { + if (SDL_RenderSetLogicalSize(renderer_, w, h) != 0) + throw Exception("SDL_RenderSetLogicalSize failed"); +} + +void Renderer::SetScale(float scaleX, float scaleY) { + if (SDL_RenderSetScale(renderer_, scaleX, scaleY) != 0) + throw Exception("SDL_RenderSetScale failed"); +} + +void Renderer::SetViewport(const Rect& rect) { + if (SDL_RenderSetViewport(renderer_, rect.Get()) != 0) + throw Exception("SDL_RenderSetViewport failed"); +} + +bool Renderer::TargetSupported() { + return SDL_RenderTargetSupported(renderer_); +} + } diff --git a/SDL2pp/Renderer.hh b/SDL2pp/Renderer.hh index cc3c521..a58f582 100644 --- a/SDL2pp/Renderer.hh +++ b/SDL2pp/Renderer.hh @@ -53,7 +53,6 @@ public: SDL_Renderer* Get() const; - void SetLogicalSize(int w, int h); void Present(); void Clear(); @@ -87,6 +86,13 @@ public: void FillRects(const Rect* rects, int count); void ReadPixels(const Rect& rect, Uint32 format, void* pixels, int pitch); + + void SetClipRect(const Rect& rect); + void SetLogicalSize(int w, int h); + void SetScale(float scaleX, float scaleY); + void SetViewport(const Rect& rect); + + bool TargetSupported(); }; }