Skip to content

Commit 8f44a6f

Browse files
dogunboundChrisThrasher
authored andcommitted
Implement resize for Texture
1 parent e39a0b1 commit 8f44a6f

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

include/CSFML/Graphics/Texture.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,20 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_copy(const sfTexture* texture);
178178
////////////////////////////////////////////////////////////
179179
CSFML_GRAPHICS_API void sfTexture_destroy(const sfTexture* texture);
180180

181+
////////////////////////////////////////////////////////////
182+
/// \brief Resize the texture
183+
///
184+
/// If this function fails, the texture is left unchanged.
185+
///
186+
/// \param texture Texture to resize
187+
/// \param size Width and height of the texture
188+
/// \param sRgb `true` to enable sRGB conversion, `false` to disable it
189+
///
190+
/// \return `true` if resizing was successful, `false` if it failed
191+
///
192+
////////////////////////////////////////////////////////////
193+
CSFML_GRAPHICS_API bool sfTexture_resize(sfTexture* texture, sfVector2u size, bool sRgb);
194+
181195
////////////////////////////////////////////////////////////
182196
/// \brief Return the size of the texture
183197
///

src/CSFML/Graphics/Texture.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ void sfTexture_destroy(const sfTexture* texture)
170170
}
171171

172172

173+
////////////////////////////////////////////////////////////
174+
bool sfTexture_resize(sfTexture* texture, sfVector2u size, bool sRgb)
175+
{
176+
assert(texture);
177+
assert(texture->This);
178+
return texture->This->resize(convertVector2(size), sRgb);
179+
}
180+
181+
173182
////////////////////////////////////////////////////////////
174183
sfVector2u sfTexture_getSize(const sfTexture* texture)
175184
{

0 commit comments

Comments
 (0)