◆ Object()
Parses a json Tiled object
- Parameters
-
◆ get()
template<typename T >
T tson::Object::get |
( |
const std::string & |
name | ) |
|
|
inline |
A shortcut for getting a property. Alternative to getProperties().getValue<T>("<name>")
- Template Parameters
-
- Parameters
-
- Returns
- The actual value, if it exists. Otherwise: The default value of the type.
◆ getClass()
◆ getClassType()
const std::string & tson::Object::getClassType |
( |
| ) |
const |
|
inline |
'class': String assigned to class field in editor This was renamed from 'type' to 'class' in Tiled v1.9
- Returns
◆ getFlipFlags()
tson::TileFlipFlags tson::Object::getFlipFlags |
( |
| ) |
const |
|
inline |
Get all flip flags
- Returns
◆ getGid()
uint32_t tson::Object::getGid |
( |
| ) |
const |
|
inline |
'gid': GID, only if object comes from a Tilemap
- Returns
◆ getId()
int tson::Object::getId |
( |
| ) |
const |
|
inline |
'id': Incremental id - unique across all objects
- Returns
◆ getName()
const std::string & tson::Object::getName |
( |
| ) |
const |
|
inline |
'name': String assigned to name field in editor
- Returns
◆ getObjectType()
tson::ObjectType tson::Object::getObjectType |
( |
| ) |
const |
|
inline |
Gets what type of object this is.
- Returns
◆ getPolygons()
const std::vector< tson::Vector2i > & tson::Object::getPolygons |
( |
| ) |
const |
|
inline |
'polygon': A list of x,y coordinates in pixels. If this is a Polygon type, this function will return the points used to create it
- Returns
◆ getPolylines()
const std::vector< tson::Vector2i > & tson::Object::getPolylines |
( |
| ) |
const |
|
inline |
'polyline': A list of x,y coordinates in pixels If this is a Polyline type, this function will return the points used to create it
- Returns
◆ getPosition()
'x' and 'y': coordinate in pixels
- Returns
◆ getProp()
Shortcut for getting a property object. Alternative to getProperties().getProperty("<name>");
- Parameters
-
- Returns
◆ getProperties()
'properties': A list of properties (name, value, type).
- Returns
◆ getRotation()
float tson::Object::getRotation |
( |
| ) |
const |
|
inline |
'rotation': Angle in degrees clockwise
- Returns
◆ getSize()
x = 'width' (Width in pixels), y = 'height' (Height in pixels). Ignored if using a gid.)
- Returns
◆ getTemplate()
const std::string & tson::Object::getTemplate |
( |
| ) |
const |
|
inline |
'template': Reference to a template file, in case object is a template instance
- Returns
◆ getText()
const tson::Text & tson::Object::getText |
( |
| ) |
const |
|
inline |
'type': String assigned to type field in editor
- Returns
◆ getType()
const std::string & tson::Object::getType |
( |
| ) |
const |
|
inline |
'type': String assigned to type field in editor This was renamed to 'class' in Tiled v1.9
- Returns
◆ hasFlipFlags()
bool tson::Object::hasFlipFlags |
( |
TileFlipFlags |
flags | ) |
|
|
inline |
- Parameters
-
flags | Which flags to check for. Several flags can be checked at once using the bitwise or operator. Example: hasFlipFlags(TileFlipFlags::Vertically | TileFlipFlags::Horizontally) |
- Returns
- true if the flag(s) specified are set
◆ isEllipse()
bool tson::Object::isEllipse |
( |
| ) |
const |
|
inline |
'ellipse': Used to mark an object as an ellipse
- Returns
◆ isPoint()
bool tson::Object::isPoint |
( |
| ) |
const |
|
inline |
'point': Used to mark an object as a point
- Returns
- true if the object is of type point
◆ isVisible()
bool tson::Object::isVisible |
( |
| ) |
const |
|
inline |
Declared in tileson_forward.hpp
'visible': Whether object is shown in editor.
- Returns
◆ parse()
Parses a json Tiled object and autoamtically determines the object type based on the data presented. Call getObjectType() to see what object type it is.
- Parameters
-
- Returns
- true if all mandatory fields was found. false otherwise.
◆ setObjectTypeByJson()
void tson::Object::setObjectTypeByJson |
( |
IJson & |
json | ) |
|
|
inlineprivate |
Sets an object type based on json data.
- Parameters
-
◆ m_ellipse
bool tson::Object::m_ellipse {} |
|
private |
Says with object type this is
◆ m_flipFlags
tson::TileFlipFlags tson::Object::m_flipFlags = TileFlipFlags::None |
|
private |
'x' and 'y': coordinate in pixels
◆ m_gid
uint32_t tson::Object::m_gid {} |
|
private |
'ellipse': Used to mark an object as an ellipse
◆ m_id
int tson::Object::m_id {} |
|
private |
x = 'width' (Width in pixels), y = 'height' (Height in pixels). Ignored if using a gid.)
◆ m_map
Resolved using bit 32, 31 and 30 from gid
◆ m_name
std::string tson::Object::m_name |
|
private |
'id': Incremental id - unique across all objects
◆ m_point
bool tson::Object::m_point {} |
|
private |
'name': String assigned to name field in editor
◆ m_polygon
'point': Used to mark an object as a point
◆ m_polyline
'polygon': A list of x,y coordinates in pixels
◆ m_position
'visible': Whether object is shown in editor.
◆ m_properties
'polyline': A list of x,y coordinates in pixels
◆ m_rotation
float tson::Object::m_rotation {} |
|
private |
'properties': A list of properties (name, value, type).
◆ m_size
'gid': GID, only if object comes from a Tilemap
◆ m_template
std::string tson::Object::m_template |
|
private |
'rotation': Angle in degrees clockwise
◆ m_text
'template': Reference to a template file, in case object is a template instance
◆ m_type
std::string tson::Object::m_type |
|
private |
first: 'text' second: 'wrap'
◆ m_visible
bool tson::Object::m_visible {} |
|
private |
'type': String assigned to type field in editor
The documentation for this class was generated from the following file: