Class MapOrientations

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

public class MapOrientations
extends java.lang.Object
A class containing various standard map orientations.
  • Field Summary

    Fields 
    Modifier and TypeFieldDescription
    static IMapOrientationHEXAGONAL
    A hexagonal IMapOrientation, consistent with the behavior of Tiled.
    static IMapOrientationISOMETRIC
    An isometric IMapOrientation, consistent with the behavior of Tiled.
    static IMapOrientationISOMETRIC_STAGGERED
    A staggered isometric IMapOrientation, consistent with the behavior of Tiled.
    static IMapOrientationORTHOGONAL
    An IMapOrientation for orthogonal maps, consistent with the behavior of Tiled.
  • Method Summary

    Modifier and TypeMethodDescription
    static IMapOrientationforName​(java.lang.String name)
    Determines the appropriate IMapOrientation instance for the given name.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ORTHOGONAL

      public static final IMapOrientation ORTHOGONAL

      An IMapOrientation for orthogonal maps, consistent with the behavior of Tiled.

      With this orientation, tiles are treated as rectangles with dimensions equal to the tile size, layed out in rows and columns starting with the origin.

    • ISOMETRIC

      public static final IMapOrientation ISOMETRIC

      An isometric IMapOrientation, consistent with the behavior of Tiled.

      With this orientation, the shapes of tiles are transformed into an isometric coordinate system via the transformation (x, y) -> ((x-y)/2, (x+y)/2). Rectangles within this coordinate system are rendered as diamond shapes. Points are also translated such that every tile in a map fits in the first quadrant.

      This orientation does not transform map objects into its coordinate system. Maps with an odd-numbered tile width or height will throw IllegalArgumentExceptions when using this orientation.

    • ISOMETRIC_STAGGERED

      public static final IMapOrientation ISOMETRIC_STAGGERED

      A staggered isometric IMapOrientation, consistent with the behavior of Tiled.

      This orientation is similar to the isometric orientation, but the tile coordinates are changed to be arranged in a rectangular area. The locations of tiles are positioned using rectangular coordinates, with tiles with parity on the stagger axis matching the stagger index filling the gaps between the other tiles.

      This orientation requires that a stagger axis and stagger index be set. If either are missing, an IllegalArgumentException will be thrown. Like the standard isometric orientation, this orientation will also throw an IllegalArgumentException when used with a map with an odd-numbered tile width or height.

    • HEXAGONAL

      public static final IMapOrientation HEXAGONAL

      A hexagonal IMapOrientation, consistent with the behavior of Tiled.

      Tiles are arranged in the same manner as the staggered isometric orientation (the staggered isometric orientation can be viewed as a special case of this orientation with a hex side length of 0), with extra space between tiles (the hex side length) added on the stagger axis to allow for a hexagonal shape.

      This orientation has the same requirements as staggered isometric, with the additional restriction that the hex side length must be an even number.

  • Method Details

    • forName

      public static IMapOrientation forName​(java.lang.String name)
      Determines the appropriate IMapOrientation instance for the given name. If no such orientation exists, this method returns null.
      Parameters:
      name - The name of the orientation, as stored in the TMX file
      Returns:
      The IMapOrientation by the given name