Addressed comments in pull request #99

This commit is contained in:
Vraiment 2017-07-04 09:58:53 -07:00
parent 2f3d9a9b5e
commit 49251c31a8
8 changed files with 15 additions and 11 deletions

View File

@ -1,6 +1,6 @@
/* /*
libSDL2pp - C++11 bindings/wrapper for SDL2 libSDL2pp - C++11 bindings/wrapper for SDL2
Copyright (C) 2013-2015 Dmitry Marakasov <amdmi3@amdmi3.ru> Copyright (C) 2017 Vraiment <jemc44@gmail.com>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@ -1,6 +1,6 @@
/* /*
libSDL2pp - C++11 bindings/wrapper for SDL2 libSDL2pp - C++11 bindings/wrapper for SDL2
Copyright (C) 2013-2015 Dmitry Marakasov <amdmi3@amdmi3.ru> Copyright (C) 2017 Vraiment <jemc44@gmail.com>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@ -197,7 +197,7 @@ Renderer& Renderer::SetDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
return *this; return *this;
} }
Renderer& Renderer::SetDrawColor(const Color color) { Renderer& Renderer::SetDrawColor(const Color& color) {
return SetDrawColor(color.r, color.g, color.b, color.a); return SetDrawColor(color.r, color.g, color.b, color.a);
} }

View File

@ -314,7 +314,7 @@ public:
/// \see http://wiki.libsdl.org/SDL_SetRenderDrawColor /// \see http://wiki.libsdl.org/SDL_SetRenderDrawColor
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Renderer& SetDrawColor(const Color color); Renderer& SetDrawColor(const Color& color);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Set current render target to default /// \brief Set current render target to default

View File

@ -147,8 +147,8 @@ SDL_BlendMode Surface::GetBlendMode() const {
Color Surface::GetColorAndAlphaMod() const { Color Surface::GetColorAndAlphaMod() const {
Color color; Color color;
GetColorMod(color.r, color.g, color.b); GetColorMod(color.r, color.g, color.b);
color.SetAlpha(GetAlphaMod()); color.a = GetAlphaMod();
return color; return color;
} }
@ -187,7 +187,7 @@ Surface& Surface::SetColorMod(Uint8 r, Uint8 g, Uint8 b) {
return *this; return *this;
} }
Surface& Surface::SetColorAndAlphaMod(const Color color) { Surface& Surface::SetColorAndAlphaMod(const Color& color) {
return SetColorMod(color.r, color.g, color.b).SetAlphaMod(color.a); return SetColorMod(color.r, color.g, color.b).SetAlphaMod(color.a);
} }

View File

@ -398,6 +398,7 @@ public:
/// ///
/// \throws SDL2pp::Exception /// \throws SDL2pp::Exception
/// ///
/// \see http://wiki.libsdl.org/SDL_GetSurfaceAlphaMod
/// \see http://wiki.libsdl.org/SDL_GetSurfaceColorMod /// \see http://wiki.libsdl.org/SDL_GetSurfaceColorMod
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -499,10 +500,11 @@ public:
/// ///
/// \throws SDL2pp::Exception /// \throws SDL2pp::Exception
/// ///
/// \see http://wiki.libsdl.org/SDL_SetSurfaceAlphaMod
/// \see http://wiki.libsdl.org/SDL_SetSurfaceColorMod /// \see http://wiki.libsdl.org/SDL_SetSurfaceColorMod
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Surface& SetColorAndAlphaMod(const Color color); Surface& SetColorAndAlphaMod(const Color& color);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Set the RLE acceleration hint for a surface /// \brief Set the RLE acceleration hint for a surface

View File

@ -157,7 +157,7 @@ Texture& Texture::SetColorMod(Uint8 r, Uint8 g, Uint8 b) {
return *this; 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); 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 Texture::GetColorAndAlphaMod() const {
Color color; Color color;
GetColorMod(color.r, color.g, color.b); GetColorMod(color.r, color.g, color.b);
color.SetAlpha(GetAlphaMod()); color.a = GetAlphaMod();
return color; return color;
} }

View File

@ -431,10 +431,11 @@ public:
/// ///
/// \throws SDL2pp::Exception /// \throws SDL2pp::Exception
/// ///
/// \see http://wiki.libsdl.org/SDL_SetTextureAlphaMod
/// \see http://wiki.libsdl.org/SDL_SetTextureColorMod /// \see http://wiki.libsdl.org/SDL_SetTextureColorMod
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Texture& SetColorAndAlphaMod(const Color color = Color{255, 255, 255, 255}); Texture& SetColorAndAlphaMod(const Color& color = Color{255, 255, 255, SDL_ALPHA_OPAQUE});
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Lock texture for write-only pixel access /// \brief Lock texture for write-only pixel access
@ -559,6 +560,7 @@ public:
/// ///
/// \throws SDL2pp::Exception /// \throws SDL2pp::Exception
/// ///
/// \see http://wiki.libsdl.org/SDL_GetTextureAlphaMod
/// \see http://wiki.libsdl.org/SDL_GetTextureColorMod /// \see http://wiki.libsdl.org/SDL_GetTextureColorMod
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////