From 2379a402d9246ad73ba792e587e557a710ea7040 Mon Sep 17 00:00:00 2001 From: Vraiment Date: Mon, 3 Jul 2017 22:30:39 -0700 Subject: [PATCH] Added Color support for Texture --- SDL2pp/Texture.cc | 4 ++-- SDL2pp/Texture.hh | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/SDL2pp/Texture.cc b/SDL2pp/Texture.cc index 9218e2a..282d935 100644 --- a/SDL2pp/Texture.cc +++ b/SDL2pp/Texture.cc @@ -157,7 +157,7 @@ Texture& Texture::SetColorMod(Uint8 r, Uint8 g, Uint8 b) { return *this; } -Texture& Texture::SetColorAndAlphaMod(const Color& color) { +Texture& Texture::SetColorAndAlphaMod(const Color color) { return SetColorMod(color.r, color.g, color.b).SetAlphaMod(color.a); } @@ -222,7 +222,7 @@ void Texture::GetColorMod(Uint8& r, Uint8& g, Uint8& b) const { Color Texture::GetColorAndAlphaMod() const { Color color; GetColorMod(color.r, color.g, color.b); - color.a = GetAlphaMod(); + color.SetAlpha(GetAlphaMod()); return color; } diff --git a/SDL2pp/Texture.hh b/SDL2pp/Texture.hh index 70f947d..35818aa 100644 --- a/SDL2pp/Texture.hh +++ b/SDL2pp/Texture.hh @@ -431,11 +431,10 @@ public: /// /// \throws SDL2pp::Exception /// - /// \see http://wiki.libsdl.org/SDL_SetTextureAlphaMod /// \see http://wiki.libsdl.org/SDL_SetTextureColorMod /// //////////////////////////////////////////////////////////// - Texture& SetColorAndAlphaMod(const Color& color = Color{255, 255, 255, SDL_ALPHA_OPAQUE}); + Texture& SetColorAndAlphaMod(const Color color = Color{255, 255, 255, 255}); //////////////////////////////////////////////////////////// /// \brief Lock texture for write-only pixel access @@ -560,7 +559,6 @@ public: /// /// \throws SDL2pp::Exception /// - /// \see http://wiki.libsdl.org/SDL_GetTextureAlphaMod /// \see http://wiki.libsdl.org/SDL_GetTextureColorMod /// ////////////////////////////////////////////////////////////