GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
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.
 
double GetTimeBetweenFrames () const
 Get the time between each sprite.
 
void SetTimeBetweenFrames (double 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...
 
const std::vector< gd::String > & GetSpriteNames () const
 Return a vector of references to sprite names. 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

◆ GetSprite() [1/2]

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.

◆ GetSprite() [2/2]

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.

◆ GetSpriteNames()

const std::vector< gd::String > & gd::Direction::GetSpriteNames ( ) const

Return a vector of references to sprite names.

Returns
A vector of all sprite names references.

◆ GetSpritesCount()

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

◆ HasNoSprites()

bool gd::Direction::HasNoSprites ( ) const

Check if the direction contains sprites.

Returns
true if the direction does not have any sprite.

◆ RemoveSprite()

void gd::Direction::RemoveSprite ( std::size_t  index)

Remove the sprite at the specified position.

Bound-checking is made.

◆ SetMetadata()

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.

◆ SetTimeBetweenFrames()

void gd::Direction::SetTimeBetweenFrames ( double  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: