Mana
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
SpriteDef Class Reference

Defines a class to load an animation. More...

#include <spritedef.h>

Inheritance diagram for SpriteDef:
Resource

Public Member Functions

ActiongetAction (const std::string &action) const
 Returns the specified action.
 
- Public Member Functions inherited from Resource
 Resource ()=default
 
void incRef ()
 Increments the internal reference count.
 
void decRef (OrphanPolicy orphanPolicy=DeleteLater)
 Decrements the reference count.
 
const std::string & getIdPath () const
 Return the path identifying this resource.
 

Static Public Member Functions

static SpriteDefload (const std::string &file, int variant)
 Loads a sprite definition file.
 
static SpriteDirection makeSpriteDirection (const std::string &direction)
 Converts a string into a SpriteDirection enum.
 

Private Member Functions

 SpriteDef ()
 
 ~SpriteDef () override
 
void loadSprite (XML::Node spriteNode, int variant, const std::string &palettes=std::string())
 Loads a sprite element.
 
void loadImageSet (XML::Node node, const std::string &palettes)
 Loads an imageset element.
 
void loadAction (XML::Node node, int variant_offset)
 Loads an action element.
 
void loadAnimation (XML::Node animationNode, Action *action, ImageSet *imageSet, int variant_offset)
 Loads an animation element.
 
void includeSprite (XML::Node includeNode)
 Include another sprite into this one.
 
void substituteActions ()
 Complete missing actions by copying existing ones.
 
void substituteAction (std::string complete, std::string with)
 When there are no animations defined for the action "complete", its animations become a copy of those of the action "with".
 

Private Attributes

std::map< std::string, ResourceRef< ImageSet > > mImageSets
 
std::map< std::string, Action * > mActions
 

Additional Inherited Members

- Public Types inherited from Resource
enum  OrphanPolicy { DeleteLater , DeleteImmediately }
 
- Protected Member Functions inherited from Resource
virtual ~Resource ()=default
 

Detailed Description

Defines a class to load an animation.

Definition at line 86 of file spritedef.h.

Constructor & Destructor Documentation

◆ SpriteDef()

SpriteDef::SpriteDef ( )
inlineprivate

Definition at line 106 of file spritedef.h.

◆ ~SpriteDef()

SpriteDef::~SpriteDef ( )
overrideprivate

Definition at line 316 of file spritedef.cpp.

Member Function Documentation

◆ getAction()

Action * SpriteDef::getAction ( const std::string &  action) const

Returns the specified action.

Definition at line 41 of file spritedef.cpp.

◆ includeSprite()

void SpriteDef::includeSprite ( XML::Node  includeNode)
private

Include another sprite into this one.

Definition at line 288 of file spritedef.cpp.

◆ load()

SpriteDef * SpriteDef::load ( const std::string &  file,
int  variant 
)
static

Loads a sprite definition file.

Definition at line 54 of file spritedef.cpp.

◆ loadAction()

void SpriteDef::loadAction ( XML::Node  node,
int  variant_offset 
)
private

Loads an action element.

Definition at line 169 of file spritedef.cpp.

◆ loadAnimation()

void SpriteDef::loadAnimation ( XML::Node  animationNode,
Action action,
ImageSet imageSet,
int  variant_offset 
)
private

Loads an animation element.

Definition at line 208 of file spritedef.cpp.

◆ loadImageSet()

void SpriteDef::loadImageSet ( XML::Node  node,
const std::string &  palettes 
)
private

Loads an imageset element.

Definition at line 142 of file spritedef.cpp.

◆ loadSprite()

void SpriteDef::loadSprite ( XML::Node  spriteNode,
int  variant,
const std::string &  palettes = std::string() 
)
private

Loads a sprite element.

Definition at line 112 of file spritedef.cpp.

◆ makeSpriteDirection()

SpriteDirection SpriteDef::makeSpriteDirection ( const std::string &  direction)
static

Converts a string into a SpriteDirection enum.

Definition at line 331 of file spritedef.cpp.

◆ substituteAction()

void SpriteDef::substituteAction ( std::string  complete,
std::string  with 
)
private

When there are no animations defined for the action "complete", its animations become a copy of those of the action "with".

Definition at line 87 of file spritedef.cpp.

◆ substituteActions()

void SpriteDef::substituteActions ( )
private

Complete missing actions by copying existing ones.

Definition at line 99 of file spritedef.cpp.

Member Data Documentation

◆ mActions

std::map<std::string, Action *> SpriteDef::mActions
private

Definition at line 150 of file spritedef.h.

◆ mImageSets

std::map<std::string, ResourceRef<ImageSet> > SpriteDef::mImageSets
private

Definition at line 149 of file spritedef.h.


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