sfSprite Class Reference

#include <Sprite.hpp>

Inheritance diagram for sfSprite:

sfDrawable sfAnimatedSprite List of all members.

Public Member Functions

 sfSprite (const sfImage *Img=NULL, const sfColor &Col=sfColor::White, float X=0.f, float Y=0.f, float Rot=0.f, float Sc=1.f)
float GetWidth () const
float GetHeight () const

Public Attributes

const sfImageImage
 Image used to draw the sprite.
sfColor Color
 Color of the sprite (modulated with image -- contains transparency chanel).
float Left
 Left position of sprite on screen (can be outside it).
float Top
 Top position of sprite on screen (can be outside it).
float Rotation
 Angle of rotation (in degrees).
float Scale
 Scale of sprite (must be strictly positive).
sfIntRect SubRect
 Sub-rectangle of source image to assign to the sprite.

Protected Member Functions

virtual void Render (sfRenderWindow &Window)

Detailed Description

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

Definition at line 42 of file Sprite.hpp.


Constructor & Destructor Documentation

sfSprite::sfSprite ( const sfImage Img = NULL,
const sfColor Col = sfColor::White,
float  X = 0.f,
float  Y = 0.f,
float  Rot = 0.f,
float  Sc = 1.f 
)

Construct the sprite from its parameters

Parameters:
Img : Image of the sprite (NULL by default)
Col : Color of the sprite (white by default)
X : Left coordinate of the sprite (0 by default)
Y : Top coordinate of the sprite (0 by default)
Rot : Orientation of the sprite (in degrees) (0 by default)
Sc : Scale of the sprite (1 by default)

Definition at line 38 of file Sprite.cpp.


Member Function Documentation

float sfSprite::GetWidth (  )  const

Get sprite width on screen

Returns:
Width of sprite

Definition at line 97 of file Sprite.cpp.

References sfRect< T >::GetWidth(), Scale, and SubRect.

Referenced by Render().

float sfSprite::GetHeight (  )  const

Get sprite height on screen

Returns:
Height of sprite

Definition at line 106 of file Sprite.cpp.

References sfRect< T >::GetHeight(), Scale, and SubRect.

Referenced by Render().

void sfSprite::Render ( sfRenderWindow Window  )  [protected, virtual]

/see sfDrawable::Render

Implements sfDrawable.

Reimplemented in sfAnimatedSprite.

Definition at line 54 of file Sprite.cpp.

References sfColor::Alpha, sfImage::Bind(), sfColor::Blue, sfRect< T >::Bottom, Color, GetHeight(), sfImage::GetHeight(), sfRect< T >::GetHeight(), sfImage::GetTexCoords(), GetWidth(), sfImage::GetWidth(), sfRect< T >::GetWidth(), sfColor::Green, Image, sfRect< T >::Left, Left, sfColor::Red, sfRect< T >::Right, Rotation, SubRect, sfRect< T >::Top, and Top.

Referenced by sfAnimatedSprite::Render().


The documentation for this class was generated from the following files:
Generated for SFML by  doxygen 1.5.2