diff --git a/src/lib.rs b/src/lib.rs index cd201360dd4eddcb5dd8791913fbd5682f1e197c..4014ac95c59c60f40cf40447c947d56f1d17f833 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -829,6 +829,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)] @@ -897,6 +898,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(()) @@ -950,6 +955,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();