FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
FIFE::Map Class Reference

#include <map.h>

Inheritance diagram for FIFE::Map:
Collaboration diagram for FIFE::Map:

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)
uint32_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)
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.

Destructor

Definition at line 60 of file map.cpp.

References deleteLayers().


Member Function Documentation

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

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

Definition at line 179 of file map.cpp.

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

Adds new change listener

Parameters:
listenerto add

Definition at line 164 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 85 of file map.cpp.

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

Delete a layer from the map

Definition at line 104 of file map.cpp.

Delete all layers from the map

Definition at line 121 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 218 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 229 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 71 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(), FIFE::Camera::render(), and FIFE::Camera::testRenderedViewPort().

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

uint32_t FIFE::Map::getNumLayers ( ) const

Get the overall number of layers

Definition at line 81 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().

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 201 of file map.cpp.

Removes associated change listener

Parameters:
listenerto remove

Definition at line 168 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().

Called periodically to update events on map

Returns:
true, if map was changed

Definition at line 134 of file map.cpp.


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