tmxlite
lightweight Tiled tmx map parser for C++
|
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 | Shape { Rectangle, Ellipse, Point, Polygon, Polyline, Text } |
Public Member Functions | |
void | parse (const pugi::xml_node &) |
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 of the Object, as defined in the editor. | |
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. | |
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) | |
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 () |
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.