Class MapUtilities

java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.MapUtilities

public final class MapUtilities extends Object
  • Method Details

    • getBounds

      public static Rectangle2D getBounds(IMapObject... objects)
    • getMaxMapId

      public static int getMaxMapId(IMap map)
    • getTileBoundingBox

      public static Rectangle2D getTileBoundingBox(IMap map, Rectangle2D box)
    • getTile

      public static Point getTile(Point2D mapLocation)
      Get the corresponding tile for a given pixel map location. This is an overload taking the Map from the current environment to calculate a tile location.
      Parameters:
      mapLocation - the pixel map location.
      Returns:
      The x / y tile coordinate for the given location.
      See Also:
    • getTile

      public static Point getTile(IMap map, Point2D mapLocation)
      Get the corresponding tile for a given pixel map location.
      Parameters:
      map - The map on which to calculate the tile location.
      mapLocation - the pixel map location.
      Returns:
      The x / y tile coordinate for the given mapLocation.
    • isStaggeredRowOrColumn

      public static boolean isStaggeredRowOrColumn(StaggerIndex staggerIndex, int index)
      Check if the row or column with the given index is staggered.
      Parameters:
      staggerIndex - the staggerIndex property of the map. Every second row (or column, depending on the StaggerAxis of the map is staggered half a tile.
      index - the index of the current row or column for which we want to determine if it's staggered or not.
      Returns:
      a boolean representing if the row or column with the given index is staggered.
    • getMapLocation

      public static Point2D getMapLocation(IMap map, Point tileLocation)
    • getTilesByPixelLocation

      public static List<ITile> getTilesByPixelLocation(IMap map, Point2D location)
    • getTopMostTile

      public static ITile getTopMostTile(Point2D location)
    • getTopMostTile

      public static ITile getTopMostTile(IMap map, Point2D location)
    • getTopMostTile

      public static ITile getTopMostTile(Point point)
    • getTopMostTile

      public static ITile getTopMostTile(IMap map, Point point)
    • findTileSet

      public static ITileset findTileSet(IMap map, ITile tile)
      Searches for the tile set that contains the specified tile, identified by the grid id.
      Parameters:
      map - the map
      tile - the tile
      Returns:
      the tileset
    • convertPolyshapeToPath

      public static Path2D convertPolyshapeToPath(IMapObject mapObject)
    • getAbsolutePolyshapePoints

      public static List<Point2D> getAbsolutePolyshapePoints(IMapObject mapObject)
    • findMapObject

      public static IMapObject findMapObject(IMap map, int id)
    • getTileBoundingBox

      public static Rectangle2D getTileBoundingBox(Point2D mapLocation)
    • getTileBoundingBox

      public static Rectangle2D getTileBoundingBox(IMap map, Point2D mapLocation)
    • getTileBoundingBox

      public static Rectangle2D getTileBoundingBox(int x, int y)
    • getTileBoundingBox

      public static Rectangle2D getTileBoundingBox(IMap map, int x, int y)
    • getTileBoundingBox

      public static Rectangle2D getTileBoundingBox(Point tile)
    • getTileBoundingBox

      public static Rectangle2D getTileBoundingBox(IMap map, Point tile)