22 #ifndef FIFE_MAP_MAP_H
23 #define FIFE_MAP_MAP_H
66 virtual void onMapChanged(
Map* map, std::vector<Layer*>& changedLayers) = 0;
95 const std::vector<RendererBase*>& renderers,
TimeProvider* tp_master=NULL);
136 const Layer* to_layer, std::vector<ModelCoordinate>& matching_coords)
const;
194 const std::vector<Camera*>&
getCameras()
const;
Abstract interface for all the renderbackends.
Timeprovider is an utility providing time management functionality You can have hierarchy of time pro...
bool update()
Called periodically to update events on map.
void setMultiplier(float multiplier)
With multiplier, you can adjust the time speed.
bool isChanged()
Returns true, if map information was changed during previous update round.
void setId(const std::string &id)
Sets the identifier for this map.
Layer * getLayer(const std::string &identifier)
Get the layer with the given id.
Camera * addCamera(const std::string &id, Layer *layer, const Rect &viewport)
Adds camera to the map.
void removeChangeListener(MapChangeListener *listener)
Removes associated change listener.
virtual ~MapChangeListener()
std::map< Instance *, Location > m_transferInstances
holds instances which should be transferred on the next update
void addChangeListener(MapChangeListener *listener)
Adds new change listener.
Base class for all fife classes Used e.g.
void deleteLayers()
Delete all layers from the map.
virtual void onMapChanged(Map *map, std::vector< Layer * > &changedLayers)=0
Called when some layer is changed on map.
Camera describes properties of a view port shown in the main screen Main screen can have multiple cam...
std::vector< MapChangeListener * > m_changeListeners
listeners for map changes
Camera * getCamera(const std::string &id)
Get a camera by its identifier.
uint32_t getLayerCount() const
Get the overall number of layers.
std::vector< Layer * > & getChangedLayers()
Returns layers that were changed during previous update round.
std::list< Layer * > m_layers
void deleteLayer(Layer *)
Delete a layer from the 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 w...
float getTimeMultiplier() const
Gets model speed.
float getMultiplier() const
Map & operator=(const Map &map)
void removeInstanceForTransfer(Instance *instance)
Removes instance that should be transferred to another layer.
Layer * createLayer(const std::string &identifier, CellGrid *grid)
Add a Layer to this Map.
void addInstanceForTransfer(Instance *instance, const Location &target)
Adds instance that is to be transferred to another layer.
void getMinMaxCoordinates(ExactModelCoordinate &min, ExactModelCoordinate &max)
Retrieves the minimum/maximum coordinates of instances on the map.
std::vector< Layer * > m_changedLayers
holds changed layers after each update
const std::string & getFilename() const
void setTimeMultiplier(float multip)
Sets speed for the map.
virtual void onLayerDelete(Map *map, Layer *layer)=0
Called when some instance gets deleted on layer.
void removeCamera(const std::string &id)
Removes a camera from the map.
const std::string & getId() const
Get the identifier for this map.
std::vector< Camera * > m_cameras
holds the cameras attached to this map
TimeProvider m_timeProvider
virtual void onLayerCreate(Map *map, Layer *layer)=0
Called when some layer gets created on the map.
const std::list< Layer * > & getLayers() const
Get the layers on this map.
void 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.
bool m_changed
true, if something was changed on map during previous update (layer change, creation, deletion)
void finalizeCellCaches()
Creates cellcaches for this map.
TimeProvider * getTimeProvider()
Gets timeprovider used in the map.
void initializeCellCaches()
Creates cellcaches for this map.
std::vector< RendererBase * > m_renderers
holds handles to all created renderers
const std::vector< Camera * > & getCameras() const
Get a list containing all cameras.
RenderBackend * m_renderBackend
pointer to renderbackend
An Instance is an "instantiation" of an Object at a Location.
void setFilename(const std::string &file)
Listener interface for changes happening on map.