Class that allows for the movment, scaling and rotation of 2D images. More...
#include <Graphics/Sprite.h>
Inherited by AnimatedSprite.
Public Member Functions | |
| Sprite () | |
| Default constructor. | |
| Sprite (const char *file) | |
| Constructs a Sprite using the given file. | |
| bool | Load (const char *file) |
| Sets the image the Sprite takes. | |
| void | SetAngle (float a) |
| Sets angle of rotation for the Sprite. | |
| void | Rotate (float a) |
| Increments the angle of rotation for the Sprite. | |
| float | Angle () const |
| Gets the current angle of the Sprite. | |
| void | SetPosition (const Point2f &p) |
| Sets the position of the Sprite. | |
| void | Move (const Point2f &p) |
| Moves the position of the Sprite. | |
| Point2f | Position () const |
| Gets the current position of the Sprite. | |
| void | SetTransparency (float t) |
| Sets the opacity of the Sprite. | |
| void | Fade (float t) |
| Fades the Sprite in and out. | |
| float | Transparency () const |
| Gets the current transparency of the Sprite. | |
| void | SetSize (float w, float h) |
| Sets the size of the Sprite. | |
| void | SetWidth (float w) |
| Sets the width of the Sprite. | |
| void | SetHeight (float h) |
| Sets the height of the Sprite. | |
| void | SetWidthUniform (float w) |
| Sets the width of the Sprite and scales the height uniformly. | |
| void | SetHeightUniform (float h) |
| Sets the height of the Sprite and scales the width uniformly. | |
| void | SetScale (float s) |
| Sets the uniform scale of the Sprite. | |
| void | SetScale (float sx, float sy) |
| Sets the nonuniform scale of the Sprite. | |
| void | Grow (float s) |
| Scales the Sprite uniformly. | |
| void | Grow (float sx, float sy) |
| Scales the Sprite non-uniformly. | |
| void | Scale (float &sx, float &sy) const |
| Gets the scaling factors for the Sprite. | |
| void | GetDimensions (float &w, float &h) const |
| Retrives the width and height of the Sprite. | |
| float | GetHeight () const |
| Retrives the height of the Sprite. | |
| float | GetWidth () const |
| Retrives the Width of the Sprite. | |
| AABB | GetBBox () const |
| Computes the bounding box for the Sprite. | |
| bool | CanDraw () const |
| Determines if the sprite is in a state where it can be drawn. | |
| void | Draw (Image::DrawLocation loc=Image::CENTER) const |
| Draws the sprite. | |
| void | Draw (const Point2f &p, Image::DrawLocation loc=Image::CENTER) const |
| Draws the sprite. | |
| void | DrawSubArea (const Rectf &area, Image::DrawLocation loc=Image::CENTER) const |
| Draws a portion of the sprite. | |
| void | DrawSubArea (const Point2f &p, const Rectf &area, Image::DrawLocation loc=Image::CENTER) const |
| Draws a portion of the sprite. | |
| ImageRef | GetImage () |
| Gets the image associated with the Sprite. | |
Class that allows for the movment, scaling and rotation of 2D images.
| Sprite::Sprite | ( | const char * | file | ) |
Constructs a Sprite using the given file.
| [in] | file | the file name of the image to load. |
| float Sprite::Angle | ( | ) | const [inline] |
| bool Sprite::CanDraw | ( | ) | const |
Determines if the sprite is in a state where it can be drawn.
| void Sprite::Draw | ( | const Point2f & | p, | |
| Image::DrawLocation | loc = Image::CENTER | |||
| ) | const |
| void Sprite::Draw | ( | Image::DrawLocation | loc = Image::CENTER |
) | const |
| void Sprite::DrawSubArea | ( | const Point2f & | p, | |
| const Rectf & | area, | |||
| Image::DrawLocation | loc = Image::CENTER | |||
| ) | const |
| void Sprite::DrawSubArea | ( | const Rectf & | area, | |
| Image::DrawLocation | loc = Image::CENTER | |||
| ) | const |
| void Sprite::Fade | ( | float | t | ) |
| AABB Sprite::GetBBox | ( | ) | const |
| void Sprite::GetDimensions | ( | float & | w, | |
| float & | h | |||
| ) | const [inline] |
| float Sprite::GetHeight | ( | ) | const [inline] |
| ImageRef Sprite::GetImage | ( | ) | [inline] |
| float Sprite::GetWidth | ( | ) | const [inline] |
| void Sprite::Grow | ( | float | sx, | |
| float | sy | |||
| ) |
| void Sprite::Grow | ( | float | s | ) |
| bool Sprite::Load | ( | const char * | file | ) |
Sets the image the Sprite takes.
| [in] | file | the file name of the image to load. |
| void Sprite::Move | ( | const Point2f & | p | ) |
| Point2f Sprite::Position | ( | ) | const [inline] |
| void Sprite::Rotate | ( | float | a | ) |
Increments the angle of rotation for the Sprite.
| [in] | a | the angle in radians. |
| void Sprite::Scale | ( | float & | sx, | |
| float & | sy | |||
| ) | const [inline] |
Gets the scaling factors for the Sprite.
| [out] | sx | the scaling factor along the x-axis. |
| [out] | sy | the scaling factor along the y-axis. |
| void Sprite::SetAngle | ( | float | a | ) |
Sets angle of rotation for the Sprite.
| [in] | a | the angle in radians. |
| void Sprite::SetHeight | ( | float | h | ) |
Sets the height of the Sprite.
| [in] | h | the desired height of the sprite |
Computes the scale factor that make the loaded image have the given width.
| void Sprite::SetHeightUniform | ( | float | h | ) |
Sets the height of the Sprite and scales the width uniformly.
| [in] | h | the desired height of the sprite |
Computes the scale factor that make the loaded image have the given height.
| void Sprite::SetPosition | ( | const Point2f & | p | ) |
| void Sprite::SetScale | ( | float | sx, | |
| float | sy | |||
| ) |
Sets the nonuniform scale of the Sprite.
| [in] | sx | the scaling factor along the x-axis, . |
| [in] | sy | the scaling factor along the y-axis, . |
| void Sprite::SetScale | ( | float | s | ) |
Sets the uniform scale of the Sprite.
| [in] | s | the uniform scaling factor, . |
| void Sprite::SetSize | ( | float | w, | |
| float | h | |||
| ) |
Sets the size of the Sprite.
| [in] | w | the desired width of the sprite |
| [in] | h | the desired height of the sprite |
Computes the scale factors to make the loaded image have the given width and height.
| void Sprite::SetTransparency | ( | float | t | ) |
| void Sprite::SetWidth | ( | float | w | ) |
Sets the width of the Sprite.
| [in] | w | the desired width of the sprite |
Computes the scale factor that make the loaded image have the given width.
| void Sprite::SetWidthUniform | ( | float | w | ) |
Sets the width of the Sprite and scales the height uniformly.
| [in] | w | the desired width of the sprite |
Computes the scale factor that make the loaded image have the given width.
| float Sprite::Transparency | ( | ) | const [inline] |
1.6.3