Skip to content

Commit 787de96

Browse files
authored
libtiled-java: Add ROTATED_HEXAGONAL_120_FLAG (#4315)
1 parent d94c6a3 commit 787de96

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

util/java/libtiled-java/src/main/java/org/mapeditor/core/TileLayer.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,4 +559,16 @@ public boolean isFlippedDiagonally(int x, int y) {
559559
return getBounds().contains(x, y) &&
560560
(flags[y][x] & (int)TMXMapReader.FLIPPED_DIAGONALLY_FLAG) != 0;
561561
}
562+
563+
/**
564+
* Check if tile at (x, y) is rotated 120 degrees (hexagonal maps)
565+
*
566+
* @param x Tile-space x coordinate
567+
* @param y Tile-space y coordinate
568+
* @return <code>true</code> if tile at (x, y) has hexagonal 120 rotation flag
569+
*/
570+
public boolean isRotatedHexagonal120(int x, int y) {
571+
return getBounds().contains(x, y) &&
572+
(flags[y][x] & (int)TMXMapReader.ROTATED_HEXAGONAL_120_FLAG) != 0;
573+
}
562574
}

util/java/libtiled-java/src/main/java/org/mapeditor/io/TMXMapReader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ public class TMXMapReader {
9292
public static final long FLIPPED_HORIZONTALLY_FLAG = 0x0000000080000000L;
9393
public static final long FLIPPED_VERTICALLY_FLAG = 0x0000000040000000L;
9494
public static final long FLIPPED_DIAGONALLY_FLAG = 0x0000000020000000L;
95+
public static final long ROTATED_HEXAGONAL_120_FLAG = 0x0000000010000000L;
9596

9697
public static final long ALL_FLAGS =
97-
FLIPPED_HORIZONTALLY_FLAG | FLIPPED_VERTICALLY_FLAG | FLIPPED_DIAGONALLY_FLAG;
98+
FLIPPED_HORIZONTALLY_FLAG | FLIPPED_VERTICALLY_FLAG | FLIPPED_DIAGONALLY_FLAG | ROTATED_HEXAGONAL_120_FLAG;
9899

99100
private Map map;
100101
private URL xmlPath;

0 commit comments

Comments
 (0)