Class Tile
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.xml.CustomPropertyProvider
de.gurkenlabs.litiengine.environment.tilemap.xml.Tile
- All Implemented Interfaces:
ICustomPropertyProvider
,ITile
public class Tile
extends CustomPropertyProvider
implements ITile
Field Summary
Fields Modifier and Type Field Description static Tile
EMPTY
protected static int
FLIPPED_DIAGONALLY_FLAG
protected static int
FLIPPED_HORIZONTALLY_FLAG
protected static int
FLIPPED_VERTICALLY_FLAG
static int
NONE
Constructor Summary
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object anObject)
Tests for equality between two tiles.int
getGridId()
Gets the grid id.java.awt.image.BufferedImage
getImage()
java.util.Map<java.lang.String,ICustomProperty>
getProperties()
Returns aMap
view of the custom properties for thisICustomPropertyProvider
.java.awt.Point
getTileCoordinate()
Gets the tile coordinate.ITilesetEntry
getTilesetEntry()
boolean
hasCustomProperty(java.lang.String name)
Checks if a custom property with the given name is present.int
hashCode()
Computes a hash code for this tile.boolean
isFlipped()
boolean
isFlippedDiagonally()
boolean
isFlippedHorizontally()
boolean
isFlippedVertically()
void
setProperties(java.util.Map<java.lang.String,ICustomProperty> props)
Sets all of the custom properties on this object to the provided values.java.lang.String
toString()
Methods inherited from class de.gurkenlabs.litiengine.environment.tilemap.xml.CustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, getTypeOfProperty, removeProperty, setTypeOfProperty, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface de.gurkenlabs.litiengine.environment.tilemap.ICustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, getTypeOfProperty, removeProperty, setTypeOfProperty, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
Field Details
NONE
public static final int NONE- See Also:
- Constant Field Values
EMPTY
FLIPPED_HORIZONTALLY_FLAG
protected static final int FLIPPED_HORIZONTALLY_FLAG- See Also:
- Constant Field Values
FLIPPED_VERTICALLY_FLAG
protected static final int FLIPPED_VERTICALLY_FLAG- See Also:
- Constant Field Values
FLIPPED_DIAGONALLY_FLAG
protected static final int FLIPPED_DIAGONALLY_FLAG- See Also:
- Constant Field Values
Constructor Details
Tile
public Tile()Instantiates a newTile
instance.Tile
Instantiates a newTile
instance with the same attributes as a givenTile
.- Parameters:
original
- The original tile from which the values will be copied to this new instance.
Tile
public Tile(int gidBitmask)Instantiates a newTile
instance.- Parameters:
gidBitmask
- The grid ID bitmask used to identify flags of this instance.- See Also:
FLIPPED_HORIZONTALLY_FLAG
,FLIPPED_DIAGONALLY_FLAG
,FLIPPED_VERTICALLY_FLAG
Method Details
hasCustomProperty
public boolean hasCustomProperty(java.lang.String name)Description copied from interface:ICustomPropertyProvider
Checks if a custom property with the given name is present.- Specified by:
hasCustomProperty
in interfaceICustomPropertyProvider
- Overrides:
hasCustomProperty
in classCustomPropertyProvider
- Parameters:
name
- the name of the custom property- Returns:
- true if a custom property with the given name is present. False otherwise.
getProperties
Description copied from interface:ICustomPropertyProvider
Returns aMap
view of the custom properties for thisICustomPropertyProvider
.- Specified by:
getProperties
in interfaceICustomPropertyProvider
- Overrides:
getProperties
in classCustomPropertyProvider
- Returns:
- a
Map
view of the custom properties for thisICustomPropertyProvider
setProperties
Description copied from interface:ICustomPropertyProvider
Sets all of the custom properties on this object to the provided values. Properties are added when they only exist in the provided properties, and deleted when they only exist in the current properties.- Specified by:
setProperties
in interfaceICustomPropertyProvider
- Overrides:
setProperties
in classCustomPropertyProvider
- Parameters:
props
- the new list of properties
isFlippedDiagonally
public boolean isFlippedDiagonally()- Specified by:
isFlippedDiagonally
in interfaceITile
isFlippedHorizontally
public boolean isFlippedHorizontally()- Specified by:
isFlippedHorizontally
in interfaceITile
isFlippedVertically
public boolean isFlippedVertically()- Specified by:
isFlippedVertically
in interfaceITile
isFlipped
public boolean isFlipped()getImage
public java.awt.image.BufferedImage getImage()getGridId
public int getGridId()Description copied from interface:ITile
Gets the grid id.getTileCoordinate
public java.awt.Point getTileCoordinate()Description copied from interface:ITile
Gets the tile coordinate.- Specified by:
getTileCoordinate
in interfaceITile
- Returns:
- the tile coordinate
getTilesetEntry
- Specified by:
getTilesetEntry
in interfaceITile
equals
public boolean equals(java.lang.Object anObject)Description copied from interface:ITile
Tests for equality between two tiles. Two tiles are equal if they have the same grid ID, flipped flags, and tileset entry.hashCode
public int hashCode()Description copied from interface:ITile
Computes a hash code for this tile. A tile's hash code is equal to its stored grid ID, i.e. the gid bitmask, xor the tileset entry's hash code.toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object