FIFE::Layer Class Reference
#include <layer.h>
List of all members.
Public Member Functions |
| Layer (const std::string &identifier, Map *map, CellGrid *grid) |
| ~Layer () |
const std::string & | getId () const |
void | setId (const std::string &id) |
Map * | getMap () const |
CellGrid * | getCellGrid () const |
void | setCellGrid (CellGrid *grid) |
InstanceTree * | getInstanceTree (void) const |
bool | hasInstances () const |
Instance * | createInstance (Object *object, const ModelCoordinate &p, const std::string &id="") |
Instance * | createInstance (Object *object, const ExactModelCoordinate &p, const std::string &id="") |
bool | addInstance (Instance *instance, const ExactModelCoordinate &p) |
void | deleteInstance (Instance *object) |
const std::vector< Instance * > & | getInstances () const |
std::vector< Instance * > | getInstances (const std::string &id) |
std::vector< Instance * > | getInstancesAt (Location &loc, bool use_exactcoordinates=false) |
Instance * | getInstance (const std::string &identifier) |
void | setInstancesVisible (bool vis) |
void | setLayerTransparency (uint8_t transparency) |
uint8_t | getLayerTransparency () |
void | getMinMaxCoordinates (ModelCoordinate &min, ModelCoordinate &max, const Layer *layer=0) const |
bool | cellContainsBlockingInstance (const ModelCoordinate &cellCoordinate) |
void | toggleInstancesVisible () |
bool | areInstancesVisible () const |
bool | update () |
void | setPathingStrategy (PathingStrategy strategy) |
PathingStrategy | getPathingStrategy () const |
void | addChangeListener (LayerChangeListener *listener) |
void | removeChangeListener (LayerChangeListener *listener) |
bool | isChanged () |
std::vector< Instance * > & | getChangedInstances () |
Detailed Description
A basic layer on a map
Definition at line 92 of file layer.h.
Constructor & Destructor Documentation
FIFE::Layer::Layer |
( |
const std::string & |
identifier, |
|
|
Map * |
map, |
|
|
CellGrid * |
grid | |
|
) |
| | |
Constructor Layers are created by calling addLayer from map, thus this method should really be called only by map or test code
Definition at line 43 of file layer.cpp.
Member Function Documentation
Adds new change listener
- Parameters:
-
Definition at line 256 of file layer.cpp.
Add a valid instance at a specific position. This is temporary. It will be moved to a higher level later so that we can ensure that each Instance only lives in one layer.
Definition at line 88 of file layer.cpp.
bool FIFE::Layer::areInstancesVisible |
( |
|
) |
const [inline] |
Check object visibility
- See also:
- setObjectsVisible
Definition at line 205 of file layer.h.
bool FIFE::Layer::cellContainsBlockingInstance |
( |
const ModelCoordinate & |
cellCoordinate |
) |
|
Determines if a given cell on the layer contains a blocking instance
- Parameters:
-
| cellCoordinate | A const reference to a model coordinate of the cell in question. |
- Returns:
- A boolean, true if it is blocked false otherwise.
Definition at line 221 of file layer.cpp.
Add an instance of an object at a specific position
Add an instance of an object at a specific position
Definition at line 65 of file layer.cpp.
void FIFE::Layer::deleteInstance |
( |
Instance * |
object |
) |
|
Remove an instance from the layer
Definition at line 110 of file layer.cpp.
CellGrid* FIFE::Layer::getCellGrid |
( |
|
) |
const [inline] |
Get the Cellgrid
- Returns:
- a valid cellgrid
Definition at line 119 of file layer.h.
std::vector<Instance*>& FIFE::Layer::getChangedInstances |
( |
|
) |
[inline] |
Returns instances that were changed during previous update round.
- Note:
- does not contain created or deleted instances
Definition at line 239 of file layer.h.
const std::string& FIFE::Layer::getId |
( |
|
) |
const [inline] |
Get the id of this layer.
Definition at line 106 of file layer.h.
Instance * FIFE::Layer::getInstance |
( |
const std::string & |
identifier |
) |
|
Get the first instance on this layer with the given identifier.
Definition at line 129 of file layer.cpp.
std::vector< Instance * > FIFE::Layer::getInstances |
( |
const std::string & |
id |
) |
|
Get the list of instances on this layer with the given identifier.
Definition at line 139 of file layer.cpp.
const std::vector<Instance*>& FIFE::Layer::getInstances |
( |
|
) |
const [inline] |
Get the list of instances on this layer
Definition at line 154 of file layer.h.
std::vector< Instance * > FIFE::Layer::getInstancesAt |
( |
Location & |
loc, |
|
|
bool |
use_exactcoordinates = false | |
|
) |
| | |
Returns instances that match given location.
- Parameters:
-
| loc | location where to fetch instances from |
| use_exactcoordinates | if true, comparison is done using exact coordinates. if not, cell coordinates are used |
Definition at line 149 of file layer.cpp.
InstanceTree* FIFE::Layer::getInstanceTree |
( |
void |
|
) |
const [inline] |
Get the instance tree.
- Returns:
- this layers instance tree.
Definition at line 128 of file layer.h.
uint8_t FIFE::Layer::getLayerTransparency |
( |
|
) |
|
Returns the layer's transparency value
Definition at line 213 of file layer.cpp.
Map* FIFE::Layer::getMap |
( |
|
) |
const [inline] |
Get the map this layer is contained in
Definition at line 114 of file layer.h.
Retrieves the minimum/maximum coordinates of instances on the layer.
- Parameters:
-
| min | A reference to a ModelCoordinate that will hold the minimum coordinate. |
| max | A reference to a ModelCoordinate that will hold the maximum coordinate. |
| layer | A pointer to another layer that can be used to cast coordinates bettween layers. |
Definition at line 168 of file layer.cpp.
bool FIFE::Layer::hasInstances |
( |
|
) |
const |
Check existance of objects on this layer
- Returns:
- True, if objects exist.
Definition at line 61 of file layer.cpp.
bool FIFE::Layer::isChanged |
( |
|
) |
[inline] |
Returns true, if layer information was changed during previous update round
Definition at line 234 of file layer.h.
Removes associated change listener
- Parameters:
-
Definition at line 260 of file layer.cpp.
void FIFE::Layer::setCellGrid |
( |
CellGrid * |
grid |
) |
[inline] |
Set the Cellgrid
Definition at line 123 of file layer.h.
void FIFE::Layer::setId |
( |
const std::string & |
id |
) |
[inline] |
Sets the identifier for this layer.
Definition at line 110 of file layer.h.
void FIFE::Layer::setInstancesVisible |
( |
bool |
vis |
) |
|
Set object visibility
Definition at line 205 of file layer.cpp.
void FIFE::Layer::setLayerTransparency |
( |
uint8_t |
transparency |
) |
|
Sets the transparency of all instances on the layer. 0=opaque, 255=transparent transparency Transparency value from 0-255.
Definition at line 209 of file layer.cpp.
void FIFE::Layer::toggleInstancesVisible |
( |
|
) |
|
Toggle object visibility
- See also:
- setObjectsVisible
Definition at line 217 of file layer.cpp.
bool FIFE::Layer::update |
( |
|
) |
|
Called periodically to update events on layer
- Returns:
- true if layer was changed since the last update, false otherwise
Definition at line 233 of file layer.cpp.
The documentation for this class was generated from the following files: