Game Develop C++ Platform: Sprite Class Reference

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | List of all members
Sprite Class Reference
Built-in Sprite Object extension

Represents a sprite to be included in a Direction and to display on the screen. More...

`#include <Sprite.h>`

## Public Member Functions

const sf::Sprite & | GetSFMLSprite () const
sf::Sprite & | GetSFMLSprite ()
void | LoadImage (boost::shared_ptr< SFMLTextureWrapper > image)
boost::shared_ptr < SFMLTextureWrapper > | GetSFMLTexture ()
const boost::shared_ptr < SFMLTextureWrapper > | GetSFMLTexture () const
void | SetImageName (const std::string &image_)
const std::string & | GetImageName () const
std::string & | GetImageName ()
std::vector< Polygon2d > | GetCollisionMask () const
void | SetCustomCollisionMask (const std::vector< Polygon2d > &collisionMask)
bool | IsCollisionMaskAutomatic () const
void | SetCollisionMaskAutomatic (bool enabled)
std::vector< Point > & | GetAllNonDefaultPoints ()
const std::vector< Point > & | GetAllNonDefaultPoints () const
void | AddPoint (const Point &point)
void | DelPoint (const std::string &name)
const Point & | GetPoint (const std::string &name) const
Point & | GetPoint (const std::string &name)
bool | HasPoint (const std::string &name) const
const Point & | GetOrigine () const
Point & | GetOrigine ()
const Point & | GetCentre () const
Point & | GetCentre ()
bool | IsCentreAutomatic () const
bool | SetCentreAutomatic (bool enabled)
void | MakeSpriteOwnsItsImage ()

## Detailed Description

Represents a sprite to be included in a Direction and to display on the screen.

A sprite contains a SFML sprite to be displayed, some points, and can also have its own image ( rather than a image from ImageManager ).

See Also
  Direction
  SpriteObject

## Member Function Documentation

void Sprite::AddPoint | ( | const Point & | point) |  |

Add a point

Here is the call graph for this function:

void Sprite::DelPoint | ( | const std::string & | name) |  |

Delete point with the specified name

std::vector< Point >& Sprite::GetAllNonDefaultPoints | ( | ) |  |

inline

Return all points without origin and center

const std::vector< Point >& Sprite::GetAllNonDefaultPoints | ( | ) |  | const

inline

Return all points without origin and center

const Point& Sprite::GetCentre | ( | ) |  | const

inline

Return Centre point.

Warning
  If the image has not been loaded ( using LoadImage ) and the center point is set as automatic, the returned point won't be correct.

Point& Sprite::GetCentre | ( | ) |  |

inline

Return Centre point.

Warning
  If the image has not been loaded ( using LoadImage ) and the center point is set as automatic, the returned point won't be correct.

std::vector< Polygon2d > Sprite::GetCollisionMask | ( | ) |  | const

Get the collision mask ( custom or automatically generated owing to IsCollisionMaskAutomatic() )

Warning
  If the image has not been loaded ( using LoadImage ) and the collision mask is set as automatic, the returned mask won't be correct.

const std::string& Sprite::GetImageName | ( | ) |  | const

inline

Get the name of the Sprite's image

std::string& Sprite::GetImageName | ( | ) |  |

inline

Get a reference to the name of the image

const Point& Sprite::GetOrigine | ( | ) |  | const

inline

Return Origin point.

Point& Sprite::GetOrigine | ( | ) |  |

inline

Return Origin point.

const Point & Sprite::GetPoint | ( | const std::string & | name) |  | const

Return point with name passed in argument

Point & Sprite::GetPoint | ( | const std::string & | name) |  |

Return point with name passed in argument

const sf::Sprite& Sprite::GetSFMLSprite | ( | ) |  | const

inline

Get the SFML Sprite associated with the Sprite

sf::Sprite& Sprite::GetSFMLSprite | ( | ) |  |

inline

Get the SFML Sprite associated with the Sprite

boost::shared_ptr<SFMLTextureWrapper> Sprite::GetSFMLTexture | ( | ) |  |

inline

Get SFML Image used by the sprite

const boost::shared_ptr<SFMLTextureWrapper> Sprite::GetSFMLTexture | ( | ) |  | const

inline

Get SFML Image used by the sprite

bool Sprite::HasPoint | ( | const std::string & | name) |  | const

Return true if the point exists.

bool Sprite::IsCentreAutomatic | ( | ) |  | const

inline

Return true if the center point is automatically computed

bool Sprite::IsCollisionMaskAutomatic | ( | ) |  | const

inline

Return true if the collision mask is a bounding box, false if a custom collision mask is used.

void Sprite::LoadImage | ( | boost::shared_ptr< SFMLTextureWrapper > | image) |  |

Set a new image to the Sprite

Here is the call graph for this function:

void Sprite::MakeSpriteOwnsItsImage | ( | ) |  |

Make the sprite, if it uses an image from ImageManager, copy this image and own it inside.

bool Sprite::SetCentreAutomatic | ( | bool | enabled) |  |

Un/Set automatic centre

Here is the call graph for this function:

void Sprite::SetCollisionMaskAutomatic | ( | bool | enabled) |  |

inline

Un/Set use of the custom collision mask.

void Sprite::SetCustomCollisionMask | ( | const std::vector< Polygon2d > & | collisionMask) |  |

inline

Set the custom collision mask. Call then SetCollisionMaskAutomatic() to use it.

void Sprite::SetImageName | ( | const std::string & | image_) |  |

inline

Change the name of the Sprite's image

The documentation for this class was generated from the following files:

- Sprite.h
- Sprite.cpp