FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::ObjectVisual Class Reference

Object visual contains data that is needed for visualizing objects. More...

#include <visual.h>

+ Inheritance diagram for FIFE::ObjectVisual:
+ Collaboration diagram for FIFE::ObjectVisual:

Public Member Functions

virtual ~ObjectVisual ()
 Destructor. More...
 
void addStaticImage (uint32_t angle, int32_t image_index)
 Adds new static image with given angle (degrees) Static images are used in case there are no actions active in the instance There can be several static images for different angles, that are used in case view / layer is rotated In case there are no exact matches for current view angles, closest one is used. More...
 
int32_t getStaticImageIndexByAngle (int32_t angle)
 Returns closest matching static image for given angle. More...
 
void addStaticColorOverlay (uint32_t angle, const OverlayColors &colors)
 Adds new static color overlay with given angle (degrees). More...
 
OverlayColorsgetStaticColorOverlay (int32_t angle)
 Returns closest matching static color overlay for given angle. More...
 
void removeStaticColorOverlay (int32_t angle)
 Removes a static color overlay with given angle (degrees). More...
 
int32_t getClosestMatchingAngle (int32_t angle)
 Returns closest matching image angle for given angle. More...
 
void getStaticImageAngles (std::vector< int32_t > &angles)
 Returns list of available static image angles for this object. More...
 
bool isColorOverlay ()
 Indicates if there exists a color overlay. 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 ObjectVisualcreate (Object *object)
 Constructs and assigns it to the passed item. More...
 

Private Types

typedef std::map< uint32_t, OverlayColorsAngleColorOverlayMap
 

Private Member Functions

 ObjectVisual ()
 Constructor. More...
 

Private Attributes

type_angle2id m_angle2img
 
AngleColorOverlayMap m_colorOverlayMap
 
type_angle2id m_map
 

Additional Inherited Members

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

Detailed Description

Object visual contains data that is needed for visualizing objects.

Definition at line 91 of file visual.h.

Member Typedef Documentation

◆ AngleColorOverlayMap

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

Definition at line 150 of file visual.h.

Constructor & Destructor Documentation

◆ ~ObjectVisual()

FIFE::ObjectVisual::~ObjectVisual ( )
virtual

Destructor.

Definition at line 110 of file visual.cpp.

◆ ObjectVisual()

FIFE::ObjectVisual::ObjectVisual ( )
private

Constructor.

Definition at line 98 of file visual.cpp.

Member Function Documentation

◆ addStaticColorOverlay()

void FIFE::ObjectVisual::addStaticColorOverlay ( uint32_t  angle,
const OverlayColors colors 
)

Adds new static color overlay with given angle (degrees).

Definition at line 122 of file visual.cpp.

References FIFE::OverlayColors::changeColor(), FIFE::OverlayColors::getColorOverlayImage(), FIFE::OverlayColors::getColors(), and FIFE::OverlayColors::setColorOverlayImage().

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

+ Here is the caller graph for this function:

◆ addStaticImage()

void FIFE::ObjectVisual::addStaticImage ( uint32_t  angle,
int32_t  image_index 
)

Adds new static image with given angle (degrees) Static images are used in case there are no actions active in the instance There can be several static images for different angles, that are used in case view / layer is rotated In case there are no exact matches for current view angles, closest one is used.

Parameters
angleangle for image. 0 degrees starts from right and turns counter-clockwise (normal math notation)
image_indexindex of image to use for given degress

Definition at line 113 of file visual.cpp.

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

+ Here is the caller graph for this function:

◆ create()

ObjectVisual * FIFE::ObjectVisual::create ( Object object)
static

Constructs and assigns it to the passed item.

Definition at line 101 of file visual.cpp.

References FIFE::Object::getVisual().

Referenced by FIFE::Instance::createOwnObject(), and FIFE::ObjectLoader::load().

+ Here is the caller graph for this function:

◆ getClosestMatchingAngle()

int32_t FIFE::ObjectVisual::getClosestMatchingAngle ( int32_t  angle)

Returns closest matching image angle for given angle.

Returns
closest matching angle

Definition at line 157 of file visual.cpp.

References FIFE::getIndexByAngle().

◆ getStaticColorOverlay()

OverlayColors * FIFE::ObjectVisual::getStaticColorOverlay ( int32_t  angle)

Returns closest matching static color overlay for given angle.

Returns
pointer to OverlayColor class

Definition at line 139 of file visual.cpp.

References FIFE::getIndexByAngle().

Referenced by FIFE::Instance::getStaticColorOverlay(), and FIFE::RenderItem::getStaticImageIndexByAngle().

+ Here is the caller graph for this function:

◆ getStaticImageAngles()

void FIFE::ObjectVisual::getStaticImageAngles ( std::vector< int32_t > &  angles)

Returns list of available static image angles for this object.

Definition at line 163 of file visual.cpp.

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

+ Here is the caller graph for this function:

◆ getStaticImageIndexByAngle()

int32_t FIFE::ObjectVisual::getStaticImageIndexByAngle ( int32_t  angle)

Returns closest matching static image for given angle.

Returns
id for static image

Definition at line 117 of file visual.cpp.

References FIFE::getIndexByAngle().

Referenced by FIFE::RenderItem::getStaticImageIndexByAngle().

+ Here is the caller graph for this function:

◆ isColorOverlay()

bool FIFE::ObjectVisual::isColorOverlay ( )
inline

Indicates if there exists a color overlay.

Definition at line 141 of file visual.h.

Referenced by FIFE::RenderItem::getStaticImageIndexByAngle(), and FIFE::Instance::isStaticColorOverlay().

+ Here is the caller graph for this function:

◆ removeStaticColorOverlay()

void FIFE::ObjectVisual::removeStaticColorOverlay ( int32_t  angle)

Removes a static color overlay with given angle (degrees).

Definition at line 147 of file visual.cpp.

References FIFE::getIndexByAngle().

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_angle2img

type_angle2id FIFE::ObjectVisual::m_angle2img
private

Definition at line 148 of file visual.h.

◆ m_colorOverlayMap

AngleColorOverlayMap FIFE::ObjectVisual::m_colorOverlayMap
private

Definition at line 151 of file visual.h.

◆ m_map

type_angle2id FIFE::ObjectVisual::m_map
private

Definition at line 152 of file visual.h.


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