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 93 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 271 of file layer.cpp.
bool FIFE::Layer::areInstancesVisible |
( |
|
) |
const [inline] |
Check object visibility
- See also:
- setObjectsVisible
Definition at line 206 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 236 of file layer.cpp.
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 117 of file layer.cpp.
CellGrid* FIFE::Layer::getCellGrid |
( |
|
) |
const [inline] |
Get the Cellgrid
- Returns:
- a valid cellgrid
Definition at line 120 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 240 of file layer.h.
const std::string& FIFE::Layer::getId |
( |
|
) |
const [inline] |
Get the id of this layer.
Definition at line 107 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 144 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 154 of file layer.cpp.
const std::vector<Instance*>& FIFE::Layer::getInstances |
( |
|
) |
const [inline] |
Get the list of instances on this layer
Definition at line 155 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 164 of file layer.cpp.
InstanceTree* FIFE::Layer::getInstanceTree |
( |
void |
|
) |
const [inline] |
Get the instance tree.
- Returns:
- this layers instance tree.
Definition at line 129 of file layer.h.
uint8_t FIFE::Layer::getLayerTransparency |
( |
|
) |
|
Returns the layer's transparency value
Definition at line 228 of file layer.cpp.
Map* FIFE::Layer::getMap |
( |
|
) |
const [inline] |
Get the map this layer is contained in
Definition at line 115 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 183 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 235 of file layer.h.
Removes associated change listener
- Parameters:
-
Definition at line 275 of file layer.cpp.
void FIFE::Layer::setCellGrid |
( |
CellGrid * |
grid |
) |
[inline] |
Set the Cellgrid
Definition at line 124 of file layer.h.
void FIFE::Layer::setId |
( |
const std::string & |
id |
) |
[inline] |
Sets the identifier for this layer.
Definition at line 111 of file layer.h.
void FIFE::Layer::setInstancesVisible |
( |
bool |
vis |
) |
|
Set object visibility
Definition at line 220 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 224 of file layer.cpp.
void FIFE::Layer::toggleInstancesVisible |
( |
|
) |
|
Toggle object visibility
- See also:
- setObjectsVisible
Definition at line 232 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 248 of file layer.cpp.
The documentation for this class was generated from the following files: