[−][src]Module rs_tiled_json::property
Properties is a structure designed for describing all the different kinds of properties that Tiled allows one to describe.
They can be attached to maps, layers, tilesets, tiles, and objects and this makes them incredibly useful for describing arbitrary data within the map itself.
Each property describes: Files Strings Integers Floats Booleans Colors
In this library, each Property contains a name and a PropertyValue. PropertyValue is an enum variant that contains the data respective to the type.
[It is useful to note that should PropertyValue fail to serialize from the map, it will default to string and any related data will be stored inside.]
The relevant functions here are:
Property::get_string(&self) -> Option<&String>; Property::get_int(&self) -> Option<i32>; Property::get_float(&self) -> Option<f64>; Property::get_bool(&self) -> Option<bool>; Property::get_color(&self) -> Option<Color>;
Anything that has a properties value will implement HasProperty
which
enables a number of convenience functions to facilitate property access.
::get_property(&self, name: &str) -> Option<&tiled_json::Property>; ::get_property_vector(&self) -> &Vec<tiled_json::Property>; ::get_property_value(&self, name: &str) -> Option<&tiled_json::PropertyValue>;
Structs
Property | The structure defining all properties and how to use them. |
Enums
PropertyValue | This is the power behind the Property struct. Each variant describes a different data type. |
Traits
HasProperty |