tmxlite 1.0.0
lightweight parse for Tiled maps
|
Objects are stored in ObjectGroup layers. Objects may be rectangular, elliptical, polygonal or a polyline. Rectangular and elliptical Objects have their size determined via the AABB, whereas polygon and polyline shapes are defined by a list of points. Objects are rectangular by default. Since version 1.0 Objects also support Text nodes. More...
#include <Object.hpp>
Public Types | |
enum class | Shape { Rectangle , Ellipse , Point , Polygon , Polyline , Text } |
Public Member Functions | |
void | parse (const pugi::xml_node &, Map *) |
Attempts to parse the given xml node and read the Object properties if it is valid. | |
std::uint32_t | getUID () const |
Returns the unique ID of the Object. | |
const std::string & | getName () const |
Returns the name of the Object. | |
const std::string & | getType () const |
Returns the type (equal to class) of the Object, as defined in the editor Tiled < 1.9. | |
const std::string & | getClass () const |
Returns the class (equal to type) of the Object, as defined in the editor Tiled 1.9+. | |
const Vector2f & | getPosition () const |
Returns the position of the Object in pixels. | |
const FloatRect & | getAABB () const |
Returns the global Axis Aligned Bounding Box. The AABB is positioned via the left and top properties, and define the Object's width and height. This can be used to derive the shape of the Object if it is rectangular or elliptical. | |
float | getRotation () const |
Returns the rotation of the Object in degrees clockwise. | |
std::uint32_t | getTileID () const |
Returns the global tile ID associated with the Object if there is one. This is used to draw the Object (and therefore the Object must be rectangular) | |
std::uint8_t | getFlipFlags () const |
Returns the flip flags if the objects uses a TileID to draw it. Returns 0 otherwise. | |
bool | visible () const |
Returns whether or not the Object is visible. | |
Shape | getShape () const |
Returns the Shape type of the Object. | |
const std::vector< Vector2f > & | getPoints () const |
Returns a reference to the vector of points which make up the Object. If the Object is rectangular or elliptical then the vector will be empty. Point coordinates are in pixels, relative to the object position. | |
const std::vector< Property > & | getProperties () const |
Returns a reference to the vector of properties belonging to the Object. | |
const Text & | getText () const |
Returns a Text struct containing information about any text this object may have, such as font data and formatting. If an object does not contain any text information this struct will be populated with default values. Use getShape() to determine if this object is in fact a text object. | |
Text & | getText () |
const std::string & | getTilesetName () const |
Returns the tileset name used by this object if it is derived from a template, else returns an empty string. If the string is not empty use it to index the unordered_map returned by Map::getTemplateTilesets() | |
Objects are stored in ObjectGroup layers. Objects may be rectangular, elliptical, polygonal or a polyline. Rectangular and elliptical Objects have their size determined via the AABB, whereas polygon and polyline shapes are defined by a list of points. Objects are rectangular by default. Since version 1.0 Objects also support Text nodes.