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 ITileField Summary
Fields Modifier and Type Field Description static TileEMPTYprotected static intFLIPPED_DIAGONALLY_FLAGprotected static intFLIPPED_HORIZONTALLY_FLAGprotected static intFLIPPED_VERTICALLY_FLAGstatic intNONEConstructor Summary
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object anObject)Tests for equality between two tiles.intgetGridId()Gets the grid id.java.awt.image.BufferedImagegetImage()java.util.Map<java.lang.String,ICustomProperty>getProperties()Returns aMapview of the custom properties for thisICustomPropertyProvider.java.awt.PointgetTileCoordinate()Gets the tile coordinate.ITilesetEntrygetTilesetEntry()booleanhasCustomProperty(java.lang.String name)Checks if a custom property with the given name is present.inthashCode()Computes a hash code for this tile.booleanisFlipped()booleanisFlippedDiagonally()booleanisFlippedHorizontally()booleanisFlippedVertically()voidsetProperties(java.util.Map<java.lang.String,ICustomProperty> props)Sets all of the custom properties on this object to the provided values.java.lang.StringtoString()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, setValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 newTileinstance.Tile
Instantiates a newTileinstance 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 newTileinstance.- 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:ICustomPropertyProviderChecks if a custom property with the given name is present.- Specified by:
hasCustomPropertyin interfaceICustomPropertyProvider- Overrides:
hasCustomPropertyin 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:ICustomPropertyProviderReturns aMapview of the custom properties for thisICustomPropertyProvider.- Specified by:
getPropertiesin interfaceICustomPropertyProvider- Overrides:
getPropertiesin classCustomPropertyProvider- Returns:
- a
Mapview of the custom properties for thisICustomPropertyProvider
setProperties
Description copied from interface:ICustomPropertyProviderSets 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:
setPropertiesin interfaceICustomPropertyProvider- Overrides:
setPropertiesin classCustomPropertyProvider- Parameters:
props- the new list of properties
isFlippedDiagonally
public boolean isFlippedDiagonally()- Specified by:
isFlippedDiagonallyin interfaceITile
isFlippedHorizontally
public boolean isFlippedHorizontally()- Specified by:
isFlippedHorizontallyin interfaceITile
isFlippedVertically
public boolean isFlippedVertically()- Specified by:
isFlippedVerticallyin interfaceITile
isFlipped
public boolean isFlipped()getImage
public java.awt.image.BufferedImage getImage()getGridId
public int getGridId()Description copied from interface:ITileGets the grid id.getTileCoordinate
public java.awt.Point getTileCoordinate()Description copied from interface:ITileGets the tile coordinate.- Specified by:
getTileCoordinatein interfaceITile- Returns:
- the tile coordinate
getTilesetEntry
- Specified by:
getTilesetEntryin interfaceITile
equals
public boolean equals(java.lang.Object anObject)Description copied from interface:ITileTests 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:ITileComputes 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:
toStringin classjava.lang.Object
