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

#include <map.h>

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

Public Member Functions

 Map (const std::string &identifier, RenderBackend *renderbackend, const std::vector< RendererBase * > &renderers, 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 getLayerCount () const
 
void deleteLayers ()
 
void getMatchingCoordinates (const ModelCoordinate &coord_to_map, const Layer *from_layer, const Layer *to_layer, std::vector< ModelCoordinate > &matching_coords) const
 
void getMinMaxCoordinates (ExactModelCoordinate &min, ExactModelCoordinate &max)
 
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)
 
const std::vector< Camera * > & getCameras () const
 
- Public Member Functions inherited from FIFE::FifeClass
fifeid_t getFifeId ()
 

Detailed Description

A container of Layer(s).

The actual data is contained in Layer objects

See also
Layer

Definition at line 86 of file map.h.

Constructor & Destructor Documentation

FIFE::Map::Map ( const std::string &  identifier,
RenderBackend renderbackend,
const std::vector< RendererBase * > &  renderers,
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 44 of file map.cpp.

FIFE::Map::~Map ( )

Destructor

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

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

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

Adds new change listener

Parameters
listenerto add

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

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

Delete a layer from the map

Definition at line 100 of file map.cpp.

void FIFE::Map::deleteLayers ( )

Delete all layers from the map

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

Referenced by addCamera().

Here is the caller graph for this function:

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

Get a list containing all cameras.

Definition at line 256 of file map.cpp.

Referenced by FIFE::MapSaver::save().

Here is the caller graph for this function:

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

Returns layers that were changed during previous update round

Definition at line 176 of file map.h.

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

Get the identifier for this map.

Definition at line 102 of file map.h.

Referenced by FIFE::MapSaver::save().

Here is the caller graph for this function:

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

Get the layer with the given id.

Definition at line 67 of file map.cpp.

uint32_t FIFE::Map::getLayerCount ( ) const

Get the overall number of layers

Definition at line 77 of file map.cpp.

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

Get the layers on this map.

Definition at line 118 of file map.h.

Referenced by FIFE::RendererBase::activateAllLayers(), FIFE::Camera::render(), and FIFE::MapSaver::save().

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

void FIFE::Map::getMinMaxCoordinates ( ExactModelCoordinate min,
ExactModelCoordinate max 
)

Retrieves the minimum/maximum coordinates of instances on the map.

Parameters
minA reference to a ExactModelCoordinate that will hold the minimum coordinate.
maxA reference to a ExactModelCoordinate that will hold the maximum coordinate.

Definition at line 130 of file map.cpp.

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

Gets model speed.

See also
setTimeMultiplier.

Definition at line 154 of file map.h.

References FIFE::TimeProvider::getMultiplier().

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

Gets timeprovider used in the map

Definition at line 158 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 172 of file map.h.

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

Removes a camera from the map

Definition at line 228 of file map.cpp.

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

Removes associated change listener

Parameters
listenerto remove

Definition at line 195 of file map.cpp.

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

Sets the identifier for this map.

Definition at line 106 of file map.h.

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

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

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


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