mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00
Implement SetClipRect, SetScale, SetViewport, TargetSupported in Renderer
This commit is contained in:
parent
015a9e5be5
commit
2c7cb50fd9
@ -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_);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user