mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 10:55:57 -04:00
Added Color support for Renderer
This commit is contained in:
parent
980fe93481
commit
ddaee362a1
@ -197,6 +197,10 @@ Renderer& Renderer::SetDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
Renderer& Renderer::SetDrawColor(const Color color) {
|
||||
return SetDrawColor(color.r, color.g, color.b, color.a);
|
||||
}
|
||||
|
||||
Renderer& Renderer::SetTarget() {
|
||||
if (SDL_SetRenderTarget(renderer_, nullptr) != 0)
|
||||
throw Exception("SDL_SetRenderTarget");
|
||||
@ -411,6 +415,12 @@ SDL_BlendMode Renderer::GetDrawBlendMode() const {
|
||||
return mode;
|
||||
}
|
||||
|
||||
Color Renderer::GetDrawColor() const {
|
||||
Color color;
|
||||
GetDrawColor(color.r, color.g, color.b, color.a);
|
||||
return color;
|
||||
}
|
||||
|
||||
void Renderer::GetDrawColor(Uint8& r, Uint8& g, Uint8& b, Uint8& a) const {
|
||||
if (SDL_GetRenderDrawColor(renderer_, &r, &g, &b, &a) != 0)
|
||||
throw Exception("SDL_GetRenderDrawColor");
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <SDL2pp/Point.hh>
|
||||
#include <SDL2pp/Rect.hh>
|
||||
#include <SDL2pp/Export.hh>
|
||||
#include <SDL2pp/Color.hh>
|
||||
|
||||
struct SDL_RendererInfo;
|
||||
struct SDL_Renderer;
|
||||
@ -301,6 +302,20 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
Renderer& SetDrawColor(Uint8 r = 0, Uint8 g = 0, Uint8 b = 0, Uint8 a = 255);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set color user for drawing operations
|
||||
///
|
||||
/// \param[in] color Color to draw on the rendering target
|
||||
///
|
||||
/// \returns Reference to self
|
||||
///
|
||||
/// \throws SDL2pp::Exception
|
||||
///
|
||||
/// \see http://wiki.libsdl.org/SDL_SetRenderDrawColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Renderer& SetDrawColor(const Color color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set current render target to default
|
||||
///
|
||||
@ -752,6 +767,18 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
SDL_BlendMode GetDrawBlendMode() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the additional color value multiplied into render copy operations
|
||||
///
|
||||
/// \return Color object with the value used to do render copy operations
|
||||
///
|
||||
/// \throws SDL2pp::Exception
|
||||
///
|
||||
/// \see http://wiki.libsdl.org/SDL_GetRenderDrawColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Color GetDrawColor() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the additional color value multiplied into render copy operations
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user