FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::ActionVisual Class Reference

Action visual contains data that is needed to visualize different actions on screen. More...

#include <visual.h>

+ Inheritance diagram for FIFE::ActionVisual:
+ Collaboration diagram for FIFE::ActionVisual:

Public Member Functions

virtual ~ActionVisual ()
 Destructor. More...
 
void addAnimation (uint32_t angle, AnimationPtr animationptr)
 Adds new animation with given angle (degrees) More...
 
AnimationPtr getAnimationByAngle (int32_t angle)
 Gets index to animation closest to given angle. More...
 
void addAnimationOverlay (uint32_t angle, int32_t order, AnimationPtr animationptr)
 Adds new animation overlay with given angle (degrees) and order. More...
 
std::map< int32_t, AnimationPtrgetAnimationOverlay (int32_t angle)
 Gets map with animations closest to given angle. More...
 
void removeAnimationOverlay (uint32_t angle, int32_t order)
 Removes animation overlay with given angle (degrees) and order. More...
 
void addColorOverlay (uint32_t angle, const OverlayColors &colors)
 Adds new color overlay with given angle (degrees) and colors. More...
 
OverlayColorsgetColorOverlay (int32_t angle)
 Gets OverlayColors for given angle (degrees). More...
 
void removeColorOverlay (int32_t angle)
 Removes color overlay with given angle (degrees). More...
 
void addColorOverlay (uint32_t angle, int32_t order, const OverlayColors &colors)
 Adds new color overlay with given angle (degrees), order and colors. More...
 
OverlayColorsgetColorOverlay (int32_t angle, int32_t order)
 Gets OverlayColors for given angle (degrees) and order. More...
 
void removeColorOverlay (int32_t angle, int32_t order)
 Removes color overlay with given angle (degrees) and order. More...
 
void getActionImageAngles (std::vector< int32_t > &angles)
 Returns list of available angles for this Action. More...
 
void convertToOverlays (bool color)
 Convertes animations and optional color overlay to default animation overlay. More...
 
bool isAnimationOverlay ()
 Returns true if it exists a animation overlay, otherwise false. More...
 
bool isColorOverlay ()
 Returns true if it exists a color overlay, otherwise false. More...
 
- Public Member Functions inherited from FIFE::Visual2DGfx
virtual ~Visual2DGfx ()
 Destructor. More...
 
- Public Member Functions inherited from FIFE::IVisual
virtual ~IVisual ()
 

Static Public Member Functions

static ActionVisualcreate (Action *action)
 Constructs and assigns it to the passed item. More...
 

Private Types

typedef std::map< uint32_t, AnimationPtrAngleAnimationMap
 
typedef std::map< uint32_t, std::map< int32_t, AnimationPtr > > AngleAnimationOverlayMap
 
typedef std::map< uint32_t, OverlayColorsAngleColorOverlayMap
 
typedef std::map< uint32_t, std::map< int32_t, OverlayColors > > AngleColorAnimationOverlayMap
 

Private Member Functions

 ActionVisual ()
 Constructor. More...
 

Private Attributes

AngleAnimationMap m_animation_map
 
AngleAnimationOverlayMap m_animationOverlayMap
 
AngleColorOverlayMap m_colorOverlayMap
 
AngleColorAnimationOverlayMap m_colorAnimationOverlayMap
 
type_angle2id m_map
 

Additional Inherited Members

- Protected Member Functions inherited from FIFE::Visual2DGfx
 Visual2DGfx ()
 Constructor. More...
 

Detailed Description

Action visual contains data that is needed to visualize different actions on screen.

Definition at line 212 of file visual.h.

Member Typedef Documentation

◆ AngleAnimationMap

typedef std::map<uint32_t, AnimationPtr> FIFE::ActionVisual::AngleAnimationMap
private

Definition at line 296 of file visual.h.

◆ AngleAnimationOverlayMap

typedef std::map<uint32_t, std::map<int32_t, AnimationPtr> > FIFE::ActionVisual::AngleAnimationOverlayMap
private

Definition at line 299 of file visual.h.

◆ AngleColorAnimationOverlayMap

typedef std::map<uint32_t, std::map<int32_t, OverlayColors> > FIFE::ActionVisual::AngleColorAnimationOverlayMap
private

Definition at line 305 of file visual.h.

◆ AngleColorOverlayMap

typedef std::map<uint32_t, OverlayColors> FIFE::ActionVisual::AngleColorOverlayMap
private

Definition at line 302 of file visual.h.

Constructor & Destructor Documentation

◆ ~ActionVisual()

FIFE::ActionVisual::~ActionVisual ( )
virtual

Destructor.

Definition at line 237 of file visual.cpp.

◆ ActionVisual()

FIFE::ActionVisual::ActionVisual ( )
private

Constructor.

Definition at line 225 of file visual.cpp.

Referenced by create().

+ Here is the caller graph for this function:

Member Function Documentation

◆ addAnimation()

void FIFE::ActionVisual::addAnimation ( uint32_t  angle,
AnimationPtr  animationptr 
)

Adds new animation with given angle (degrees)

Definition at line 240 of file visual.cpp.

References m_animation_map, and m_map.

Referenced by FIFE::ObjectLoader::load().

+ Here is the caller graph for this function:

◆ addAnimationOverlay()

void FIFE::ActionVisual::addAnimationOverlay ( uint32_t  angle,
int32_t  order,
AnimationPtr  animationptr 
)

Adds new animation overlay with given angle (degrees) and order.

Definition at line 250 of file visual.cpp.

References m_animationOverlayMap, and m_map.

Referenced by FIFE::Instance::addAnimationOverlay(), and convertToOverlays().

+ Here is the caller graph for this function:

◆ addColorOverlay() [1/2]

void FIFE::ActionVisual::addColorOverlay ( uint32_t  angle,
const OverlayColors colors 
)

Adds new color overlay with given angle (degrees) and colors.

Note: Works only for single animations not for AnimationOverlays. (order is missing)

Definition at line 275 of file visual.cpp.

References FIFE::OverlayColors::changeColor(), FIFE::OverlayColors::getColorOverlayAnimation(), FIFE::OverlayColors::getColors(), m_colorOverlayMap, m_map, and FIFE::OverlayColors::setColorOverlayAnimation().

Referenced by FIFE::Instance::addColorOverlay(), and convertToOverlays().

+ Here is the caller graph for this function:

◆ addColorOverlay() [2/2]

void FIFE::ActionVisual::addColorOverlay ( uint32_t  angle,
int32_t  order,
const OverlayColors colors 
)

Adds new color overlay with given angle (degrees), order and colors.

Note: Works only for AnimationOverlays.

Definition at line 312 of file visual.cpp.

References FIFE::OverlayColors::changeColor(), FIFE::OverlayColors::getColorOverlayAnimation(), FIFE::OverlayColors::getColors(), m_colorAnimationOverlayMap, m_map, and FIFE::OverlayColors::setColorOverlayAnimation().

◆ convertToOverlays()

void FIFE::ActionVisual::convertToOverlays ( bool  color)

Convertes animations and optional color overlay to default animation overlay.

The default order value for both is 0. The old data remain, so if you remove the animation overlay the old plain animations and colors be used again.

Definition at line 369 of file visual.cpp.

References addAnimationOverlay(), addColorOverlay(), getAnimationByAngle(), getColorOverlay(), m_colorOverlayMap, and m_map.

Referenced by FIFE::Instance::convertToOverlays().

+ Here is the caller graph for this function:

◆ create()

ActionVisual * FIFE::ActionVisual::create ( Action action)
static

Constructs and assigns it to the passed item.

Definition at line 228 of file visual.cpp.

References ActionVisual(), FIFE::Action::adoptVisual(), and FIFE::Action::getVisual().

Referenced by FIFE::ObjectLoader::load().

+ Here is the caller graph for this function:

◆ getActionImageAngles()

void FIFE::ActionVisual::getActionImageAngles ( std::vector< int32_t > &  angles)

Returns list of available angles for this Action.

Definition at line 360 of file visual.cpp.

References m_map.

◆ getAnimationByAngle()

AnimationPtr FIFE::ActionVisual::getAnimationByAngle ( int32_t  angle)

Gets index to animation closest to given angle.

Returns
animation index, -1 if no animations available

Definition at line 245 of file visual.cpp.

References FIFE::getIndexByAngle(), m_animation_map, and m_map.

Referenced by convertToOverlays().

+ Here is the caller graph for this function:

◆ getAnimationOverlay()

std::map< int32_t, AnimationPtr > FIFE::ActionVisual::getAnimationOverlay ( int32_t  angle)

Gets map with animations closest to given angle.

Returns
animation map

Definition at line 256 of file visual.cpp.

References FIFE::getIndexByAngle(), m_animationOverlayMap, and m_map.

Referenced by FIFE::Instance::getAnimationOverlay(), and FIFE::LayerCache::updateVisual().

+ Here is the caller graph for this function:

◆ getColorOverlay() [1/2]

OverlayColors * FIFE::ActionVisual::getColorOverlay ( int32_t  angle)

Gets OverlayColors for given angle (degrees).

Returns
pointer to OverlayColors or Null

Definition at line 291 of file visual.cpp.

References FIFE::getIndexByAngle(), m_colorOverlayMap, and m_map.

Referenced by convertToOverlays(), FIFE::Instance::getColorOverlay(), and FIFE::LayerCache::updateVisual().

+ Here is the caller graph for this function:

◆ getColorOverlay() [2/2]

OverlayColors * FIFE::ActionVisual::getColorOverlay ( int32_t  angle,
int32_t  order 
)

Gets OverlayColors for given angle (degrees) and order.

Returns
pointer to OverlayColors or Null

Definition at line 329 of file visual.cpp.

References FIFE::getIndexByAngle(), m_colorAnimationOverlayMap, and m_map.

◆ isAnimationOverlay()

bool FIFE::ActionVisual::isAnimationOverlay ( )
inline

Returns true if it exists a animation overlay, otherwise false.

Definition at line 284 of file visual.h.

Referenced by FIFE::Instance::isAnimationOverlay(), and FIFE::LayerCache::updateVisual().

+ Here is the caller graph for this function:

◆ isColorOverlay()

bool FIFE::ActionVisual::isColorOverlay ( )
inline

Returns true if it exists a color overlay, otherwise false.

Definition at line 288 of file visual.h.

Referenced by FIFE::Instance::isColorOverlay(), and FIFE::LayerCache::updateVisual().

+ Here is the caller graph for this function:

◆ removeAnimationOverlay()

void FIFE::ActionVisual::removeAnimationOverlay ( uint32_t  angle,
int32_t  order 
)

Removes animation overlay with given angle (degrees) and order.

Definition at line 261 of file visual.cpp.

References FIFE::getIndexByAngle(), m_animationOverlayMap, and m_map.

Referenced by FIFE::Instance::removeAnimationOverlay().

+ Here is the caller graph for this function:

◆ removeColorOverlay() [1/2]

void FIFE::ActionVisual::removeColorOverlay ( int32_t  angle)

Removes color overlay with given angle (degrees).

Definition at line 303 of file visual.cpp.

References FIFE::getIndexByAngle(), m_colorOverlayMap, and m_map.

Referenced by FIFE::Instance::removeColorOverlay().

+ Here is the caller graph for this function:

◆ removeColorOverlay() [2/2]

void FIFE::ActionVisual::removeColorOverlay ( int32_t  angle,
int32_t  order 
)

Removes color overlay with given angle (degrees) and order.

Definition at line 345 of file visual.cpp.

References FIFE::getIndexByAngle(), m_colorAnimationOverlayMap, and m_map.

Member Data Documentation

◆ m_animation_map

AngleAnimationMap FIFE::ActionVisual::m_animation_map
private

Definition at line 297 of file visual.h.

Referenced by addAnimation(), and getAnimationByAngle().

◆ m_animationOverlayMap

AngleAnimationOverlayMap FIFE::ActionVisual::m_animationOverlayMap
private

Definition at line 300 of file visual.h.

Referenced by addAnimationOverlay(), getAnimationOverlay(), and removeAnimationOverlay().

◆ m_colorAnimationOverlayMap

AngleColorAnimationOverlayMap FIFE::ActionVisual::m_colorAnimationOverlayMap
private

Definition at line 306 of file visual.h.

Referenced by addColorOverlay(), getColorOverlay(), and removeColorOverlay().

◆ m_colorOverlayMap

AngleColorOverlayMap FIFE::ActionVisual::m_colorOverlayMap
private

Definition at line 303 of file visual.h.

Referenced by addColorOverlay(), convertToOverlays(), getColorOverlay(), and removeColorOverlay().

◆ m_map


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