Implement some Renderer getters

This commit is contained in:
Dmitry Marakasov 2015-01-15 16:59:40 +03:00
parent a22e667dbc
commit b6781c3d93
2 changed files with 39 additions and 0 deletions

View File

@ -273,4 +273,16 @@ Rect Renderer::GetViewport() const {
return rect;
}
SDL_BlendMode Renderer::GetDrawBlendMode() const {
SDL_BlendMode mode;
if (SDL_GetRenderDrawBlendMode(renderer_, &mode) != 0)
throw Exception("SDL_GetRenderDrawBlendMode failed");
return mode;
}
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 failed");
}
}

View File

@ -632,6 +632,33 @@ public:
///
////////////////////////////////////////////////////////////
Rect GetViewport() const;
////////////////////////////////////////////////////////////
/// \brief Get the blend mode used for drawing operations
///
/// \return Current SDL_BlendMode
///
/// \throws SDL2pp::Exception
///
/// \see http://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
///
////////////////////////////////////////////////////////////
SDL_BlendMode GetDrawBlendMode() const;
////////////////////////////////////////////////////////////
/// \brief Get the additional color value multiplied into render copy operations
///
/// \param[out] r Variable to be filled in with red value used to draw on the rendering target
/// \param[out] g Variable to be filled in with green value used to draw on the rendering target
/// \param[out] b Variable to be filled in with blue value used to draw on the rendering target
/// \param[out] a Variable to be filled in with alpha value used to draw on the rendering target
///
/// \throws SDL2pp::Exception
///
/// \see http://wiki.libsdl.org/SDL_GetRenderDrawColor
///
////////////////////////////////////////////////////////////
void GetDrawColor(Uint8& r, Uint8& g, Uint8& b, Uint8& a) const;
};
}