tmxlite 1.0.0
lightweight parse for Tiled maps
Public Member Functions | List of all members
tmx::ImageLayer Class Referencefinal

Image layers contain a single image which make up that layer. The parser contains the fully resolved path to the image relative to the working directory. More...

#include <ImageLayer.hpp>

Inheritance diagram for tmx::ImageLayer:
tmx::Layer

Public Member Functions

 ImageLayer (const std::string &)
 
Type getType () const override
 Returns a Type value representing the concrete type. Use this when deciding which conrete layer type to use when calling the templated function getLayerAs<T>()
 
void parse (const pugi::xml_node &, Map *) override
 Attempts to parse the specific node layer type.
 
const std::string & getImagePath () const
 Returns the path, relative to the working directory, of the image used by the image layer.
 
const ColourgetTransparencyColour () const
 Returns the colour used by the image to represent transparent pixels. By default this is (0, 0, 0, 0)
 
bool hasTransparency () const
 Returns true if the image used by this layer specifically states a colour to use as transparency.
 
const Vector2ugetImageSize () const
 Returns the size of the image of the image layer in pixels.
 
bool hasRepeatX () const
 Returns true if the image drawn by this layer is repeated along the X axis.
 
bool hasRepeatY () const
 Returns true if the image drawn by this layer is repeated along the Y axis.
 
- Public Member Functions inherited from tmx::Layer
const std::string & getClass () const
 Returns the class of the Layer, as defined in the editor Tiled 1.9+.
 
template<typename T >
T & getLayerAs ()
 Use this to get a reference to the concrete layer type which this layer points to. Use getType() to return the type value of this layer and determine if the concrete type is TileLayer, ObjectGroup, ImageLayer, or LayerGroup.
 
template<typename T >
const T & getLayerAs () const
 
const std::string & getName () const
 Returns the name of the layer.
 
float getOpacity () const
 Returns the opacity value for the layer.
 
bool getVisible () const
 Returns whether this layer is visible or not.
 
const Vector2igetOffset () const
 Returns the offset from the top left corner of the layer, in pixels.
 
const Vector2fgetParallaxFactor () const
 Returns the parallax factor.
 
Colour getTintColour () const
 Returns the tint colour of the layer. Defaults to 0xFFFFFFFF - pure white.
 
const Vector2ugetSize () const
 Returns the size of the layer, in pixels. This will be the same as the map size for fixed size maps.
 
const std::vector< Property > & getProperties () const
 Returns the list of properties of this layer.
 
template<>
ImageLayergetLayerAs ()
 
template<>
const ImageLayergetLayerAs () const
 
template<>
LayerGroupgetLayerAs ()
 
template<>
const LayerGroupgetLayerAs () const
 
template<>
ObjectGroupgetLayerAs ()
 
template<>
const ObjectGroupgetLayerAs () const
 
template<>
TileLayergetLayerAs ()
 
template<>
const TileLayergetLayerAs () const
 

Additional Inherited Members

- Public Types inherited from tmx::Layer
enum class  Type { Tile , Object , Image , Group }
 Layer type as returned by getType() Tile: this layer is a TileLayer type Object: This layer is an ObjectGroup type Image: This layer is an ImageLayer type Group: This layer is a LayerGroup type.
 
using Ptr = std::unique_ptr<Layer>
 
- Protected Member Functions inherited from tmx::Layer
void setName (const std::string &name)
 
void setClass (const std::string &cls)
 
void setOpacity (float opacity)
 
void setVisible (bool visible)
 
void setOffset (std::int32_t x, std::int32_t y)
 
void setParallaxFactor (float x, float y)
 
void setTintColour (Colour c)
 
void setSize (std::uint32_t width, std::uint32_t height)
 
void addProperty (const pugi::xml_node &node)
 

Detailed Description

Image layers contain a single image which make up that layer. The parser contains the fully resolved path to the image relative to the working directory.

Member Function Documentation

◆ getType()

Type tmx::ImageLayer::getType ( ) const
inlineoverridevirtual

Returns a Type value representing the concrete type. Use this when deciding which conrete layer type to use when calling the templated function getLayerAs<T>()

Implements tmx::Layer.

◆ parse()

void tmx::ImageLayer::parse ( const pugi::xml_node & ,
Map *  )
overridevirtual

Attempts to parse the specific node layer type.

Implements tmx::Layer.


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