diff --git a/src/lib.rs b/src/lib.rs index 2669afb2d1febd7f9820596143a2760b62c7d8f8..79ec13fc8e170e6144c1d817dc6d41584fb09d64 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -817,6 +817,7 @@ pub enum ObjectShape { Ellipse { width: f32, height: f32 }, Polyline { points: Vec<(f32, f32)> }, Polygon { points: Vec<(f32, f32)> }, + Point(f32, f32), } #[derive(Debug, PartialEq, Clone)] @@ -885,6 +886,10 @@ impl Object { shape = Some(Object::new_polygon(attrs)?); Ok(()) }, + "point" => |_| { + shape = Some(Object::new_point(x, y)?); + Ok(()) + }, "properties" => |_| { properties = parse_properties(parser)?; Ok(()) @@ -938,6 +943,10 @@ impl Object { Ok(ObjectShape::Polygon { points: points }) } + fn new_point(x: f32, y: f32) -> Result<ObjectShape, TiledError> { + Ok(ObjectShape::Point(x, y)) + } + fn parse_points(s: String) -> Result<Vec<(f32, f32)>, TiledError> { let pairs = s.split(' '); let mut points = Vec::new();