Sprite.h File Reference

#include <SFML/Config.h>
#include <SFML/Graphics/BlendMode.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Image.h>
#include <SFML/Graphics/Rect.h>

Go to the source code of this file.


Typedefs

typedef sfSprite sfSprite
 sfSprite defines a sprite : texture, transformations, color, and draw on screen

Functions

CSFML_API sfSpritesfSprite_Create ()
 Create a new sprite.
CSFML_API void sfSprite_Destroy (sfSprite *Sprite)
 Destroy an existing sprite.
CSFML_API void sfSprite_SetLeft (sfSprite *Sprite, float Left)
 Set the left position of a sprite.
CSFML_API void sfSprite_SetTop (sfSprite *Sprite, float Top)
 Set the top position of a sprite.
CSFML_API void sfSprite_SetPosition (sfSprite *Sprite, float Left, float Top)
 Set the position of a sprite.
CSFML_API void sfSprite_SetScaleX (sfSprite *Sprite, float Scale)
 Set the horizontal scale of a sprite.
CSFML_API void sfSprite_SetScaleY (sfSprite *Sprite, float Scale)
 Set the vertical scale of a sprite.
CSFML_API void sfSprite_SetScale (sfSprite *Sprite, float ScaleX, float ScaleY)
 Set the scale of a sprite.
CSFML_API void sfSprite_SetRotation (sfSprite *Sprite, float Rotation)
 Set the orientation of a sprite.
CSFML_API void sfSprite_SetRotationCenter (sfSprite *Sprite, float X, float Y)
 Set the center of rotation of a sprite, in coordinates relative to it.
CSFML_API void sfSprite_SetColor (sfSprite *Sprite, sfColor Color)
 Set the color of a sprite.
CSFML_API void sfSprite_SetBlendMode (sfSprite *Sprite, sfBlendMode Mode)
 Set the blending mode for a sprite.
CSFML_API float sfSprite_GetLeft (sfSprite *Sprite)
 Get the left position of a sprite.
CSFML_API float sfSprite_GetTop (sfSprite *Sprite)
 Get the top position of a sprite.
CSFML_API float sfSprite_GetScaleX (sfSprite *Sprite)
 Get the horizontal scale of a sprite.
CSFML_API float sfSprite_GetScaleY (sfSprite *Sprite)
 Get the vertical scale of a sprite.
CSFML_API float sfSprite_GetRotation (sfSprite *Sprite)
 Get the orientation of a sprite.
CSFML_API sfColor sfSprite_GetColor (sfSprite *Sprite)
 Get the color of a sprite.
CSFML_API sfBlendMode sfSprite_GetBlendMode (sfSprite *Sprite)
 Get the current blending mode of a sprite.
CSFML_API void sfSprite_Move (sfSprite *Sprite, float OffsetX, float OffsetY)
 Move a sprite.
CSFML_API void sfSprite_Scale (sfSprite *Sprite, float FactorX, float FactorY)
 Scale a sprite.
CSFML_API void sfSprite_Rotate (sfSprite *Sprite, float Angle)
 Rotate a sprite.
CSFML_API void sfSprite_SetImage (sfSprite *Sprite, sfImage *Image)
 Change the image of a sprite.
CSFML_API void sfSprite_SetSubRect (sfSprite *Sprite, const sfIntRect *SubRect)
 Set the sub-rectangle of a sprite inside the source image.
CSFML_API void sfSprite_Resize (sfSprite *Sprite, float Width, float Height)
 Resize a sprite (by changing its scale factors).
CSFML_API void sfSprite_FlipX (sfSprite *Sprite, sfBool Flipped)
 Flip a sprite horizontally.
CSFML_API void sfSprite_FlipY (sfSprite *Sprite, sfBool Flipped)
 Flip a sprite vertically.
CSFML_API sfImagesfSprite_GetImage (sfSprite *Sprite)
 Get the source image of a sprite.
CSFML_API sfIntRectsfSprite_GetSubRect (sfSprite *Sprite)
 Get the sub-rectangle of a sprite inside the source image.
CSFML_API float sfSprite_GetWidth (sfSprite *Sprite)
 Get a sprite width.
CSFML_API float sfSprite_GetHeight (sfSprite *Sprite)
 Get a sprite height.
CSFML_API sfColor sfSprite_GetPixel (sfSprite *Sprite, unsigned int X, unsigned int Y)
 Get the color of a given pixel in a sprite.

Typedef Documentation

typedef struct sfSprite sfSprite

sfSprite defines a sprite : texture, transformations, color, and draw on screen

Definition at line 42 of file Sprite.h.


Function Documentation

CSFML_API sfSprite* sfSprite_Create (  ) 

Create a new sprite.

Returns:
A new sfSprite object, or NULL if it failed

CSFML_API void sfSprite_Destroy ( sfSprite Sprite  ) 

Destroy an existing sprite.

Parameters:
Sprite : Sprite to delete

CSFML_API void sfSprite_FlipX ( sfSprite Sprite,
sfBool  Flipped 
)

Flip a sprite horizontally.

Parameters:
Sprite : Sprite to modify
Flipped : sfTrue to flip the sprite

CSFML_API void sfSprite_FlipY ( sfSprite Sprite,
sfBool  Flipped 
)

Flip a sprite vertically.

Parameters:
Sprite : Sprite to modify
Flipped : sfTrue to flip the sprite

CSFML_API sfBlendMode sfSprite_GetBlendMode ( sfSprite Sprite  ) 

Get the current blending mode of a sprite.

Parameters:
Sprite : Sprite to read
Returns:
Current blending mode

CSFML_API sfColor sfSprite_GetColor ( sfSprite Sprite  ) 

Get the color of a sprite.

Parameters:
Sprite : Sprite to read
Returns:
Current color

CSFML_API float sfSprite_GetHeight ( sfSprite Sprite  ) 

Get a sprite height.

Parameters:
Sprite : Sprite to read
Returns:
Height of the sprite

CSFML_API sfImage* sfSprite_GetImage ( sfSprite Sprite  ) 

Get the source image of a sprite.

Parameters:
Sprite : Sprite to read
Returns:
Pointer to the image (can be NULL)

CSFML_API float sfSprite_GetLeft ( sfSprite Sprite  ) 

Get the left position of a sprite.

Parameters:
Sprite : Sprite to read
Returns:
Current left position

CSFML_API sfColor sfSprite_GetPixel ( sfSprite Sprite,
unsigned int  X,
unsigned int  Y 
)

Get the color of a given pixel in a sprite.

Parameters:
Sprite : Sprite to read
X : X coordinate of the pixel to get
Y : Y coordinate of the pixel to get
Returns:
Color of pixel (X, Y)

CSFML_API float sfSprite_GetRotation ( sfSprite Sprite  ) 

Get the orientation of a sprite.

Parameters:
Sprite : Sprite to read
Returns:
Current rotation, in degrees

CSFML_API float sfSprite_GetScaleX ( sfSprite Sprite  ) 

Get the horizontal scale of a sprite.

Parameters:
Sprite : Sprite to read
Returns:
Current X scale factor (always positive)

CSFML_API float sfSprite_GetScaleY ( sfSprite Sprite  ) 

Get the vertical scale of a sprite.

Parameters:
Sprite : Sprite to read
Returns:
Current Y scale factor (always positive)

CSFML_API sfIntRect* sfSprite_GetSubRect ( sfSprite Sprite  ) 

Get the sub-rectangle of a sprite inside the source image.

Parameters:
Sprite : Sprite to read
Returns:
Sub-rectangle

CSFML_API float sfSprite_GetTop ( sfSprite Sprite  ) 

Get the top position of a sprite.

Parameters:
Sprite : Sprite to read
Returns:
Current top position

CSFML_API float sfSprite_GetWidth ( sfSprite Sprite  ) 

Get a sprite width.

Parameters:
Sprite : Sprite to read
Returns:
Width of the sprite

CSFML_API void sfSprite_Move ( sfSprite Sprite,
float  OffsetX,
float  OffsetY 
)

Move a sprite.

Parameters:
Sprite : Sprite to modify
OffsetX : Offset on the X axis
OffsetY : Offset on the Y axis

CSFML_API void sfSprite_Resize ( sfSprite Sprite,
float  Width,
float  Height 
)

Resize a sprite (by changing its scale factors).

Parameters:
Sprite : Sprite to modify
Width : New width (must be strictly positive)
Height : New height (must be strictly positive)

CSFML_API void sfSprite_Rotate ( sfSprite Sprite,
float  Angle 
)

Rotate a sprite.

Parameters:
Sprite : Sprite to modify
Angle : Angle of rotation, in degrees

CSFML_API void sfSprite_Scale ( sfSprite Sprite,
float  FactorX,
float  FactorY 
)

Scale a sprite.

Parameters:
Sprite : Sprite to modify
FactorX : Horizontal scaling factor (must be strictly positive)
FactorY : Vertical scaling factor (must be strictly positive)

CSFML_API void sfSprite_SetBlendMode ( sfSprite Sprite,
sfBlendMode  Mode 
)

Set the blending mode for a sprite.

Parameters:
Sprite : Sprite to modify
Mode : New blending mode

CSFML_API void sfSprite_SetColor ( sfSprite Sprite,
sfColor  Color 
)

Set the color of a sprite.

Parameters:
Sprite : Sprite to modify
Color : New color

CSFML_API void sfSprite_SetImage ( sfSprite Sprite,
sfImage Image 
)

Change the image of a sprite.

Parameters:
Sprite : Sprite to modify
Image : New image

CSFML_API void sfSprite_SetLeft ( sfSprite Sprite,
float  Left 
)

Set the left position of a sprite.

Parameters:
Sprite : Sprite to modify
Left : New left coordinate

CSFML_API void sfSprite_SetPosition ( sfSprite Sprite,
float  Left,
float  Top 
)

Set the position of a sprite.

Parameters:
Sprite : Sprite to modify
Left : New left coordinate
Top : New top coordinate

CSFML_API void sfSprite_SetRotation ( sfSprite Sprite,
float  Rotation 
)

Set the orientation of a sprite.

Parameters:
Sprite : Sprite to modify
Rotation : Angle of rotation, in degrees

CSFML_API void sfSprite_SetRotationCenter ( sfSprite Sprite,
float  X,
float  Y 
)

Set the center of rotation of a sprite, in coordinates relative to it.

Parameters:
Sprite : Sprite to modify
X : X coordinate of the center of rotation
Y : Y coordinate of the center of rotation

CSFML_API void sfSprite_SetScale ( sfSprite Sprite,
float  ScaleX,
float  ScaleY 
)

Set the scale of a sprite.

Parameters:
Sprite : Sprite to modify
ScaleX : New horizontal scale (must be strictly positive)
ScaleY : New vertical scale (must be strictly positive)

CSFML_API void sfSprite_SetScaleX ( sfSprite Sprite,
float  Scale 
)

Set the horizontal scale of a sprite.

Parameters:
Sprite : Sprite to modify
Scale : New scale (must be strictly positive)

CSFML_API void sfSprite_SetScaleY ( sfSprite Sprite,
float  Scale 
)

Set the vertical scale of a sprite.

Parameters:
Sprite : Sprite to modify
Scale : New scale (must be strictly positive)

CSFML_API void sfSprite_SetSubRect ( sfSprite Sprite,
const sfIntRect SubRect 
)

Set the sub-rectangle of a sprite inside the source image.

Parameters:
Sprite : Sprite to modify
SubRect : New sub-rectangle

CSFML_API void sfSprite_SetTop ( sfSprite Sprite,
float  Top 
)

Set the top position of a sprite.

Parameters:
Sprite : Sprite to modify
Top : New top coordinate