1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-29 03:23:37 +02:00

add a tiled method that doesn't require ushort casts to get tiles

This commit is contained in:
Ellpeck 2019-09-24 12:26:38 +02:00
parent dbe02645f1
commit 84e1958b4e
3 changed files with 7 additions and 3 deletions

View file

@ -33,7 +33,7 @@ namespace MLEM.Extended.Tiled {
public void UpdateDrawInfo(int layerIndex, int x, int y) {
var layer = this.map.TileLayers[layerIndex];
var tile = layer.GetTile((ushort) x, (ushort) y);
var tile = layer.GetTile(x, y);
if (tile.IsBlank)
return;
var tileset = tile.GetTileset(this.map);

View file

@ -54,7 +54,11 @@ namespace MLEM.Extended.Tiled {
public static TiledMapTile GetTile(this TiledMap map, string layerName, int x, int y) {
var layer = map.GetLayer<TiledMapTileLayer>(layerName);
return layer != null ? layer.GetTile((ushort) x, (ushort) y) : default;
return layer != null ? layer.GetTile(x, y) : default;
}
public static TiledMapTile GetTile(this TiledMapTileLayer layer, int x, int y) {
return layer.GetTile((ushort) x, (ushort) y);
}
public static RectangleF GetArea(this TiledMapObject obj, TiledMap map, Vector2 position) {

View file

@ -32,7 +32,7 @@ namespace MLEM.Extended.Tiled {
public void UpdateCollisionInfo(int layerIndex, int x, int y) {
var layer = this.map.TileLayers[layerIndex];
var tile = layer.GetTile((ushort) x, (ushort) y);
var tile = layer.GetTile(x, y);
if (tile.IsBlank)
return;
var tilesetTile = tile.GetTilesetTile(this.map);