GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | List of all members
gd::Direction Class Reference

Class defining a direction (set of frames) of an Animation. More...

#include <Direction.h>

Public Member Functions

bool IsLooping () const
 Return true if sprites looping is activated.
 
void SetLoop (bool loop_)
 Set if the sprites must be looping or not.
 
float GetTimeBetweenFrames () const
 Get the time between each sprite.
 
void SetTimeBetweenFrames (float time)
 Set the time between each sprite. More...
 
const SpriteGetSprite (std::size_t nb) const
 Return a reference to a sprite of the direction. More...
 
SpriteGetSprite (std::size_t nb)
 Return a reference to a sprite of the direction. More...
 
bool HasNoSprites () const
 Check if the direction contains sprites. More...
 
std::size_t GetSpritesCount () const
 Return the number of sprite used in the direction. More...
 
void RemoveSprite (std::size_t index)
 Remove the sprite at the specified position. More...
 
void RemoveAllSprites ()
 Clear the direction from all of its sprites.
 
void AddSprite (const Sprite &sprite)
 Add a new sprite at the end of the list.
 
void SwapSprites (std::size_t firstSpriteIndex, std::size_t secondSpriteIndex)
 Swap the position of two sprites.
 
void MoveSprite (std::size_t oldIndex, std::size_t newIndex)
 Change the position of the specified sprite.
 
virtual void SetMetadata (const gd::String &metadata_)
 Set the metadata (any string) associated to the Direction. More...
 
virtual const gd::StringGetMetadata () const
 Return the (optional) metadata associated to the Direction.
 
void UnserializeFrom (const gd::SerializerElement &element)
 
void SerializeTo (gd::SerializerElement &element) const
 

Detailed Description

Class defining a direction (set of frames) of an Animation.

See also
SpriteObject
Animation
Sprite
Todo:
Support UTF8 (currently convert all loaded strings from UTF8 to the current locale)

Member Function Documentation

const Sprite & gd::Direction::GetSprite ( std::size_t  nb) const

Return a reference to a sprite of the direction.

Parameters
nbThe index of the sprite to be accessed. Bound checking is not made.
Returns
A reference to the sprite.
Sprite & gd::Direction::GetSprite ( std::size_t  nb)

Return a reference to a sprite of the direction.

Parameters
nbThe index of the sprite to be accessed. Bound checking is not made.
Returns
A reference to the sprite.
std::size_t gd::Direction::GetSpritesCount ( ) const

Return the number of sprite used in the direction.

Returns
The number of sprite used in the direction
bool gd::Direction::HasNoSprites ( ) const

Check if the direction contains sprites.

Returns
true if the direction does not have any sprite.
void gd::Direction::RemoveSprite ( std::size_t  index)

Remove the sprite at the specified position.

Bound-checking is made.

virtual void gd::Direction::SetMetadata ( const gd::String metadata_)
inlinevirtual

Set the metadata (any string) associated to the Direction.

Note
Can be used by external editors to store extra information.
void gd::Direction::SetTimeBetweenFrames ( float  time)

Set the time between each sprite.

Parameters
timeTime between each sprite, in seconds.

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