mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00
Merge branch 'copy-to-point'
This commit is contained in:
commit
fdbca27e73
@ -88,12 +88,32 @@ Renderer& Renderer::Copy(Texture& texture, const Optional<Rect>& srcrect, const
|
||||
return *this;
|
||||
}
|
||||
|
||||
Renderer& Renderer::Copy(Texture& texture, const Optional<Rect>& srcrect, const Point& dstpoint) {
|
||||
Rect dstrect(
|
||||
dstpoint.x,
|
||||
dstpoint.y,
|
||||
srcrect ? srcrect->w : texture.GetWidth(),
|
||||
srcrect ? srcrect->h : texture.GetHeight()
|
||||
);
|
||||
return Copy(texture, srcrect, dstrect);
|
||||
}
|
||||
|
||||
Renderer& Renderer::Copy(Texture& texture, const Optional<Rect>& srcrect, const Optional<Rect>& dstrect, double angle, const Optional<Point>& center, int flip) {
|
||||
if (SDL_RenderCopyEx(renderer_, texture.Get(), srcrect ? &*srcrect : nullptr, dstrect ? &*dstrect : nullptr, angle, center ? &*center : nullptr, static_cast<SDL_RendererFlip>(flip)) != 0)
|
||||
throw Exception("SDL_RenderCopyEx");
|
||||
return *this;
|
||||
}
|
||||
|
||||
Renderer& Renderer::Copy(Texture& texture, const Optional<Rect>& srcrect, const Point& dstpoint, double angle, const Optional<Point>& center, int flip) {
|
||||
Rect dstrect(
|
||||
dstpoint.x,
|
||||
dstpoint.y,
|
||||
srcrect ? srcrect->w : texture.GetWidth(),
|
||||
srcrect ? srcrect->h : texture.GetHeight()
|
||||
);
|
||||
return Copy(texture, srcrect, dstrect, angle, center, flip);
|
||||
}
|
||||
|
||||
Renderer& Renderer::SetDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
|
||||
if (SDL_SetRenderDrawColor(renderer_, r, g, b, a) != 0)
|
||||
throw Exception("SDL_SetRenderDrawColor");
|
||||
|
@ -206,6 +206,23 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
Renderer& Copy(Texture& texture, const Optional<Rect>& srcrect = NullOpt, const Optional<Rect>& dstrect = NullOpt);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy a portion of the texture to the current rendering
|
||||
/// target (preserve texture dimensions)
|
||||
///
|
||||
/// \param[in] texture Source texture
|
||||
/// \param[in] srcrect Source rectangle, NullOpt for the entire texture
|
||||
/// \param[in] dstpoint Target point for source top left corner
|
||||
///
|
||||
/// \returns Reference to self
|
||||
///
|
||||
/// \throws SDL2pp::Exception
|
||||
///
|
||||
/// \see http://wiki.libsdl.org/SDL_RenderCopy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Renderer& Copy(Texture& texture, const Optional<Rect>& srcrect, const Point& dstpoint);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy a portion of the texture to the current rendering
|
||||
/// target with optional rotating or flipping
|
||||
@ -232,6 +249,32 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
Renderer& Copy(Texture& texture, const Optional<Rect>& srcrect, const Optional<Rect>& dstrect, double angle, const Optional<Point>& center = NullOpt, int flip = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy a portion of the texture to the current rendering
|
||||
/// target with optional rotating or flipping (preserve texture
|
||||
/// dimensions)
|
||||
///
|
||||
/// \param[in] texture Source texture
|
||||
/// \param[in] srcrect Source rectangle, NullOpt for the entire texture
|
||||
/// \param[in] dstpoint Target point for source top left corner
|
||||
/// \param[in] angle Angle in degrees that indicates the rotation that
|
||||
/// will be applied to dstrect
|
||||
/// \param[in] center Point indicating the point around which dstrect
|
||||
/// will be rotated (NullOpt to rotate around dstrect
|
||||
/// center)
|
||||
/// \param[in] flip SDL_RendererFlip value stating which flipping
|
||||
/// actions should be performed on the texture
|
||||
///
|
||||
/// \returns Reference to self
|
||||
///
|
||||
/// \throws SDL2pp::Exception
|
||||
///
|
||||
/// \see http://wiki.libsdl.org/SDL_RendererFlip
|
||||
/// \see http://wiki.libsdl.org/SDL_RenderCopyEx
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Renderer& Copy(Texture& texture, const Optional<Rect>& srcrect, const SDL2pp::Point& dstpoint, double angle, const Optional<Point>& center = NullOpt, int flip = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set color user for drawing operations
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user