libtmx  0.4.0
an C++11 library for reading TMX files
Public Member Functions | List of all members
tmx::Layer Class Referenceabstract

A layer is a layer in the whole map. More...

#include <tmx/Layer.h>

Inheritance diagram for tmx::Layer:
Inheritance graph
[legend]

Public Member Functions

 Layer (const std::string &name, double opacity, bool visible)
 Layer constructor. More...
 
virtual ~Layer ()
 Layer destructor. More...
 
virtual void accept (const Map &map, LayerVisitor &visitor) const =0
 Accept function in the visitor pattern. More...
 
const std::string & getName () const noexcept
 Get the name of the layer. More...
 
double getOpacity () const noexcept
 Get the opacity of the layer. More...
 
bool isVisible () const noexcept
 Tell whether the layer is visible. More...
 
- Public Member Functions inherited from tmx::Component
bool hasProperty (const std::string &key) const noexcept
 Tell if the object has a given property. More...
 
const std::string & getProperty (const std::string &key, const std::string &def) const noexcept
 Get a property value. More...
 
bool addProperty (const std::string &key, const std::string &value)
 Add a property. More...
 

Detailed Description

A layer is a layer in the whole map.

There are three kinds of layers: image layers, tile layers and object layers.

Constructor & Destructor Documentation

tmx::Layer::Layer ( const std::string &  name,
double  opacity,
bool  visible 
)
inline

Layer constructor.

virtual tmx::Layer::~Layer ( )
virtual

Layer destructor.

Member Function Documentation

virtual void tmx::Layer::accept ( const Map map,
LayerVisitor visitor 
) const
pure virtual

Accept function in the visitor pattern.

Parameters
visitorthe visitor

Implemented in tmx::ObjectLayer, tmx::TileLayer, and tmx::ImageLayer.

const std::string& tmx::Layer::getName ( ) const
inlinenoexcept

Get the name of the layer.

Returns
the name of the layer
double tmx::Layer::getOpacity ( ) const
inlinenoexcept

Get the opacity of the layer.

Returns
the opacity of the layer (0.0 is transparent, 1.0 is opaque)
bool tmx::Layer::isVisible ( ) const
inlinenoexcept

Tell whether the layer is visible.

Returns
true if the layer is visible