Added the missing adjustToNewSize parameter of Sprite::SetImage in CSFML

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1346 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-01-11 14:46:08 +00:00
parent 273cba055c
commit 6c44a1d33a
6 changed files with 8 additions and 7 deletions

View File

@ -303,11 +303,12 @@ CSFML_API void sfSprite_TransformToGlobal(const sfSprite* sprite, float pointX,
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Change the image of a sprite /// Change the image of a sprite
/// ///
/// \param Sprite : Sprite to modify /// \param sprite : Sprite to modify
/// \param image : New image /// \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 /// Set the sub-rectangle of a sprite inside the source image

View File

@ -304,11 +304,11 @@ void sfSprite_TransformToGlobal(const sfSprite* sprite, float pointX, float poin
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Change the image of a sprite /// 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) if (image)
{ {
CSFML_CALL(sprite, SetImage(*image->This)) CSFML_CALL(sprite, SetImage(*image->This, adjustToNewSize == sfTrue))
sprite->Image = image; sprite->Image = image;
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -177,7 +177,7 @@ namespace SFML
public Image Image public Image Image
{ {
get { return myImage; } 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); static extern float sfSprite_GetHeight(IntPtr This);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] [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] [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfSprite_SetSubRect(IntPtr This, IntRect Rect); static extern void sfSprite_SetSubRect(IntPtr This, IntRect Rect);