mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
make tiled extension area position optional
This commit is contained in:
parent
abef3cdf1a
commit
edcc7d44b5
1 changed files with 3 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue