mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-30 10:28:17 +00:00
CVideo: add method for drawing a texture flipped/mirrored.
This commit is contained in:
parent
e2d059daae
commit
64304ddb63
@ -267,6 +267,19 @@ void CVideo::blit_texture(const texture& tex, const SDL_Rect* dst_rect, const SD
|
|||||||
SDL_RenderCopy(*window.get(), tex, src_rect, dst_rect);
|
SDL_RenderCopy(*window.get(), tex, src_rect, dst_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CVideo::blit_texture_flipped(
|
||||||
|
const texture& tex,
|
||||||
|
bool flip_horizontal,
|
||||||
|
bool flip_vertical,
|
||||||
|
const SDL_Rect* dst_rect,
|
||||||
|
const SDL_Rect* src_rect)
|
||||||
|
{
|
||||||
|
SDL_RendererFlip flip =
|
||||||
|
flip_horizontal ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE
|
||||||
|
| flip_vertical ? SDL_FLIP_VERTICAL : SDL_FLIP_NONE;
|
||||||
|
SDL_RenderCopyEx(*window, tex, src_rect, dst_rect, 0.0, nullptr, flip);
|
||||||
|
}
|
||||||
|
|
||||||
void CVideo::make_fake()
|
void CVideo::make_fake()
|
||||||
{
|
{
|
||||||
fake_screen_ = true;
|
fake_screen_ = true;
|
||||||
|
@ -356,6 +356,29 @@ public:
|
|||||||
*/
|
*/
|
||||||
void blit_texture(const texture& tex, const SDL_Rect* dstrect = nullptr, const SDL_Rect* srcrect = nullptr);
|
void blit_texture(const texture& tex, const SDL_Rect* dstrect = nullptr, const SDL_Rect* srcrect = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a texture, or part of a texture, at the given location,
|
||||||
|
* also mirroring/flipping the texture horizontally and/or vertically.
|
||||||
|
*
|
||||||
|
* Calling this function with no explicit parameters will flip the
|
||||||
|
* texture horizontally.
|
||||||
|
*
|
||||||
|
* @param tex The texture to be copied / drawn.
|
||||||
|
* @param flip_horizontal Whether to flip/mirror the texture horizontally.
|
||||||
|
* @param flip_vertical Whether to flip/mirror the texture vertically.
|
||||||
|
* @param dstrect The target location to copy the texture to,
|
||||||
|
* in low-resolution game-native drawing coordinates.
|
||||||
|
* If null, this fills the entire render target.
|
||||||
|
* @param srcrect The portion of the texture to copy.
|
||||||
|
* If null, this copies the entire texture.
|
||||||
|
*/
|
||||||
|
void blit_texture_flipped(
|
||||||
|
const texture& tex,
|
||||||
|
bool flip_horizontal = true,
|
||||||
|
bool flip_vertical = false,
|
||||||
|
const SDL_Rect* dst_rect = nullptr,
|
||||||
|
const SDL_Rect* src_rect = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a portion of the low-resolution drawing surface.
|
* Render a portion of the low-resolution drawing surface.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user