Public Member Functions

FIFE::Map Class Reference

#include <map.h>

Inheritance diagram for FIFE::Map:
Inheritance graph
[legend]
Collaboration diagram for FIFE::Map:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Map (const std::string &identifier, RenderBackend *renderbackend, const std::vector< RendererBase * > &renderers, ImagePool *imagepool, AnimationPool *animpool, TimeProvider *tp_master=NULL)
 ~Map ()
const std::string & getId () const
void setId (const std::string &id)
LayercreateLayer (const std::string &identifier, CellGrid *grid)
void deleteLayer (Layer *)
const std::list< Layer * > & getLayers () const
LayergetLayer (const std::string &identifier)
size_t getNumLayers () const
void deleteLayers ()
void getMatchingCoordinates (const ModelCoordinate &coord_to_map, const Layer *from_layer, const Layer *to_layer, std::vector< ModelCoordinate > &matching_coords) const
bool update ()
void setTimeMultiplier (float multip)
float getTimeMultiplier () const
TimeProvidergetTimeProvider ()
void addChangeListener (MapChangeListener *listener)
void removeChangeListener (MapChangeListener *listener)
bool isChanged ()
std::vector< Layer * > & getChangedLayers ()
CameraaddCamera (const std::string &id, Layer *layer, const Rect &viewport, const ExactModelCoordinate &emc)
void removeCamera (const std::string &id)
CameragetCamera (const std::string &id)
std::vector< Camera * > & getCameras ()

Detailed Description

A container of Layer(s).

The actual data is contained in Layer objects

See also:
Layer

Definition at line 88 of file map.h.


Constructor & Destructor Documentation

FIFE::Map::Map ( const std::string &  identifier,
RenderBackend renderbackend,
const std::vector< RendererBase * > &  renderers,
ImagePool imagepool,
AnimationPool animpool,
TimeProvider tp_master = NULL 
)

Construct a map To add map to model, one should call Model::addMap (otherwise map is not registered with the engine properly)

Definition at line 46 of file map.cpp.

FIFE::Map::~Map (  ) 

Destructor

Definition at line 61 of file map.cpp.

References deleteLayers().


Member Function Documentation

Camera * FIFE::Map::addCamera ( const std::string &  id,
Layer layer,
const Rect viewport,
const ExactModelCoordinate emc 
)

Adds camera to the map. The Map takes ownership of the camera so don't delete it.

Definition at line 173 of file map.cpp.

References FIFE::Camera::addRenderer(), and getCamera().

void FIFE::Map::addChangeListener ( MapChangeListener listener  ) 

Adds new change listener

Parameters:
listener to add

Definition at line 158 of file map.cpp.

Layer * FIFE::Map::createLayer ( const std::string &  identifier,
CellGrid *  grid 
)

Add a Layer to this Map. Map owns the returned pointer to the new Layer, so don't delete it!

Definition at line 79 of file map.cpp.

void FIFE::Map::deleteLayer ( Layer layer  ) 

Delete a layer from the map

Definition at line 98 of file map.cpp.

void FIFE::Map::deleteLayers (  ) 

Delete all layers from the map

Definition at line 115 of file map.cpp.

Referenced by ~Map().

Here is the caller graph for this function:

Camera * FIFE::Map::getCamera ( const std::string &  id  ) 

Get a camera by its identifier.

Definition at line 213 of file map.cpp.

Referenced by addCamera().

Here is the caller graph for this function:

std::vector< Camera * > & FIFE::Map::getCameras (  ) 

Get a list containing all cameras.

Definition at line 224 of file map.cpp.

std::vector<Layer*>& FIFE::Map::getChangedLayers (  )  [inline]

Returns layers that were changed during previous update round

Definition at line 173 of file map.h.

const std::string& FIFE::Map::getId (  )  const [inline]

Get the identifier for this map.

Definition at line 105 of file map.h.

Layer * FIFE::Map::getLayer ( const std::string &  identifier  ) 

Get the layer with the given id.

Definition at line 65 of file map.cpp.

const std::list<Layer*>& FIFE::Map::getLayers (  )  const [inline]

Get the layers on this map.

Definition at line 121 of file map.h.

Referenced by FIFE::RendererBase::activateAllLayers().

Here is the caller graph for this function:

void FIFE::Map::getMatchingCoordinates ( const ModelCoordinate coord_to_map,
const Layer from_layer,
const Layer to_layer,
std::vector< ModelCoordinate > &  matching_coords 
) const

Maps coordinate from one layer to another

size_t FIFE::Map::getNumLayers (  )  const

Get the overall number of layers

Definition at line 75 of file map.cpp.

float FIFE::Map::getTimeMultiplier (  )  const [inline]

Gets model speed.

See also:
setTimeMultiplier.

Definition at line 151 of file map.h.

References FIFE::TimeProvider::getMultiplier().

TimeProvider* FIFE::Map::getTimeProvider (  )  [inline]

Gets timeprovider used in the map

Definition at line 155 of file map.h.

Referenced by FIFE::Instance::getRuntime(), and FIFE::Instance::getTotalTimeMultiplier().

Here is the caller graph for this function:

bool FIFE::Map::isChanged (  )  [inline]

Returns true, if map information was changed during previous update round

Definition at line 169 of file map.h.

void FIFE::Map::removeCamera ( const std::string &  id  ) 

Removes a camera from the map

Definition at line 196 of file map.cpp.

void FIFE::Map::removeChangeListener ( MapChangeListener listener  ) 

Removes associated change listener

Parameters:
listener to remove

Definition at line 162 of file map.cpp.

void FIFE::Map::setId ( const std::string &  id  )  [inline]

Sets the identifier for this map.

Definition at line 109 of file map.h.

void FIFE::Map::setTimeMultiplier ( float  multip  )  [inline]

Sets speed for the map. See Model::setTimeMultiplier.

Definition at line 147 of file map.h.

References FIFE::TimeProvider::setMultiplier().

bool FIFE::Map::update (  ) 

Called periodically to update events on map

Returns:
true, if map was changed

Definition at line 128 of file map.cpp.


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