From edcc7d44b58faf9e5702d6a9f231e6140e1d58da Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 25 Sep 2019 20:37:20 +0200 Subject: [PATCH] make tiled extension area position optional --- MLEM.Extended/Tiled/TiledExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MLEM.Extended/Tiled/TiledExtensions.cs b/MLEM.Extended/Tiled/TiledExtensions.cs index a15d871..c3b49da 100644 --- a/MLEM.Extended/Tiled/TiledExtensions.cs +++ b/MLEM.Extended/Tiled/TiledExtensions.cs @@ -61,9 +61,10 @@ namespace MLEM.Extended.Tiled { return layer.GetTile((ushort) x, (ushort) y); } - public static RectangleF GetArea(this TiledMapObject obj, TiledMap map, Vector2 position) { + public static RectangleF GetArea(this TiledMapObject obj, TiledMap map, Vector2? position = null) { var tileSize = map.GetTileSize(); - return new RectangleF(obj.Position / tileSize + position, new Size2(obj.Size.Width, obj.Size.Height) / tileSize); + var pos = position ?? Vector2.Zero; + return new RectangleF(obj.Position / tileSize + pos, new Size2(obj.Size.Width, obj.Size.Height) / tileSize); } public static Vector2 GetTileSize(this TiledMap map) {