public class MapOrientations
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static IMapOrientation |
HEXAGONAL
A hexagonal
IMapOrientation , consistent with the behavior of Tiled. |
static IMapOrientation |
ISOMETRIC
An isometric
IMapOrientation , consistent with the behavior of Tiled. |
static IMapOrientation |
ISOMETRIC_STAGGERED
A staggered isometric
IMapOrientation , consistent with the behavior of Tiled. |
static IMapOrientation |
ORTHOGONAL
An
IMapOrientation for orthogonal maps, consistent with the behavior of Tiled. |
Modifier and Type | Method and Description |
---|---|
static IMapOrientation |
forName(java.lang.String name)
Determines the appropriate
IMapOrientation instance for the given name. |
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.
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
IllegalArgumentException
s when using this orientation.
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.
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.
public static IMapOrientation forName(java.lang.String name)
IMapOrientation
instance for the given name. If no such orientation exists, this method returns null
.name
- The name of the orientation, as stored in the TMX fileIMapOrientation
by the given name