diff --git a/CSFML/include/SFML/Graphics/Sprite.h b/CSFML/include/SFML/Graphics/Sprite.h index 33c806b71..4285d72f9 100644 --- a/CSFML/include/SFML/Graphics/Sprite.h +++ b/CSFML/include/SFML/Graphics/Sprite.h @@ -303,11 +303,12 @@ CSFML_API void sfSprite_TransformToGlobal(const sfSprite* sprite, float pointX, //////////////////////////////////////////////////////////// /// Change the image of a sprite /// -/// \param Sprite : Sprite to modify -/// \param image : New image +/// \param sprite : Sprite to modify +/// \param image : New image +/// \param adjustToNewSize : If true, the SubRect of the sprite will be adjusted to the size of the new image /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetImage(sfSprite* sprite, const sfImage* image); +CSFML_API void sfSprite_SetImage(sfSprite* sprite, const sfImage* image, sfBool adjustToNewSize); //////////////////////////////////////////////////////////// /// Set the sub-rectangle of a sprite inside the source image diff --git a/CSFML/src/SFML/Graphics/Sprite.cpp b/CSFML/src/SFML/Graphics/Sprite.cpp index 2bb7a5618..362f5f9d8 100644 --- a/CSFML/src/SFML/Graphics/Sprite.cpp +++ b/CSFML/src/SFML/Graphics/Sprite.cpp @@ -304,11 +304,11 @@ void sfSprite_TransformToGlobal(const sfSprite* sprite, float pointX, float poin //////////////////////////////////////////////////////////// /// Change the image of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetImage(sfSprite* sprite, const sfImage* image) +void sfSprite_SetImage(sfSprite* sprite, const sfImage* image, sfBool adjustToNewSize) { if (image) { - CSFML_CALL(sprite, SetImage(*image->This)) + CSFML_CALL(sprite, SetImage(*image->This, adjustToNewSize == sfTrue)) sprite->Image = image; } } diff --git a/dotnet/extlibs/csfml-audio.dll b/dotnet/extlibs/csfml-audio.dll index 4a88df169..cf6f6a30a 100644 Binary files a/dotnet/extlibs/csfml-audio.dll and b/dotnet/extlibs/csfml-audio.dll differ diff --git a/dotnet/extlibs/csfml-graphics.dll b/dotnet/extlibs/csfml-graphics.dll index b020e3623..6dc38ae02 100644 Binary files a/dotnet/extlibs/csfml-graphics.dll and b/dotnet/extlibs/csfml-graphics.dll differ diff --git a/dotnet/extlibs/csfml-window.dll b/dotnet/extlibs/csfml-window.dll index 1c5275879..2fa646bfc 100644 Binary files a/dotnet/extlibs/csfml-window.dll and b/dotnet/extlibs/csfml-window.dll differ diff --git a/dotnet/src/Graphics/Sprite.cs b/dotnet/src/Graphics/Sprite.cs index deb98674a..02069c024 100644 --- a/dotnet/src/Graphics/Sprite.cs +++ b/dotnet/src/Graphics/Sprite.cs @@ -177,7 +177,7 @@ namespace SFML public Image Image { get { return myImage; } - set { myImage = value; sfSprite_SetImage(This, value != null ? value.This : IntPtr.Zero); } + set { myImage = value; sfSprite_SetImage(This, value != null ? value.This : IntPtr.Zero, false); } } //////////////////////////////////////////////////////////// @@ -374,7 +374,7 @@ namespace SFML static extern float sfSprite_GetHeight(IntPtr This); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfSprite_SetImage(IntPtr This, IntPtr Image); + static extern void sfSprite_SetImage(IntPtr This, IntPtr Image, bool AdjustToNewSize); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfSprite_SetSubRect(IntPtr This, IntRect Rect);