public class TiledObject extends java.lang.Object implements GameDataSerializable
TiledMap| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PROPERTY_MAP_SIZE |
| Constructor and Description |
|---|
TiledObject(int id,
float x,
float y,
float width,
float height) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsProperty(java.lang.String propertyName)
Returns if the object contains the specified property
|
boolean |
equals(java.lang.Object o) |
static TiledObject |
fromInputStream(java.io.DataInputStream inputStream) |
int |
getGid()
Returns the Tile GID of this object
|
float |
getHeight()
Returns the height of this object in pixels
|
int |
getId()
Returns the ID of this object
|
java.lang.String |
getName()
Returns the name of this object
|
TiledObjectShape |
getObjectShape()
Returns the
TiledObjectShape of this object |
org.mini2Dx.gdx.utils.ObjectMap<java.lang.String,java.lang.String> |
getProperties()
Returns this object's properties
|
java.lang.String |
getProperty(java.lang.String propertyName)
Returns the value of a specified property
|
java.lang.String |
getText() |
java.lang.String |
getType()
Returns the type of this object
|
float[] |
getVertices() |
float |
getWidth()
Returns the width of this object in pixels
|
float |
getX()
Returns the x coordinate of this object in pixels
|
float |
getY()
Returns the y coordinate of this object in pixels
|
int |
hashCode() |
boolean |
isBuiltFromTemplate() |
boolean |
isGidFlipDiagonally() |
boolean |
isGidFlipHorizontally() |
boolean |
isGidFlipVertically() |
boolean |
isVisible() |
boolean |
isWrapText() |
void |
readData(java.io.DataInputStream inputStream)
Deserializes this object from a
DataInputStream |
void |
setAsEllipse()
Marks this object as a
TiledObjectShape.ELLIPSE |
void |
setAsPoint()
Marks this object as a
TiledObjectShape.POINT |
void |
setAsPolygon(float[] vertices)
Marks this object as a
TiledObjectShape.POLYGON |
void |
setAsPolygon(java.lang.String points)
Marks this object as a
TiledObjectShape.POLYGON |
void |
setAsPolyline(float[] vertices)
Marks this object as a
TiledObjectShape.POLYLINE |
void |
setAsPolyline(java.lang.String points)
Marks this object as a
TiledObjectShape.POLYLINE |
void |
setAsText(java.lang.String text,
boolean wrapText)
Marks this object as a
TiledObjectShape.TEXT |
void |
setGid(int gid)
Sets the Tile GID of this object
|
void |
setGidFlipDiagonally(boolean gidFlipDiagonally) |
void |
setGidFlipHorizontally(boolean gidFlipHorizontally) |
void |
setGidFlipVertically(boolean gidFlipVertically) |
void |
setName(java.lang.String name)
Sets the name of this object
|
void |
setProperty(java.lang.String propertyName,
java.lang.String value)
Sets the value of a specified property
|
void |
setType(java.lang.String type)
Sets the type of this object
|
void |
setVisible(boolean visible) |
Circle |
toCircle()
Creates a new
Circle from this object. |
Point |
toPoint()
Creates a new
Point from this object. |
Polygon |
toPolygon()
Creates a new
Polygon from this object. |
org.mini2Dx.gdx.utils.Array<Point> |
toPolyline()
Creates a new
Array of Points from this object. |
Rectangle |
toRectangle()
Creates a new
Rectangle from this object. |
java.lang.String |
toString() |
void |
writeData(java.io.DataOutputStream outputStream)
Serializes this object to a
DataOutputStream |
public TiledObject(int id,
float x,
float y,
float width,
float height)
public static TiledObject fromInputStream(java.io.DataInputStream inputStream) throws java.io.IOException
java.io.IOExceptionpublic void writeData(java.io.DataOutputStream outputStream)
throws java.io.IOException
GameDataSerializableDataOutputStreamwriteData in interface GameDataSerializableoutputStream - The DataOutputStream to write tojava.io.IOException - Thrown if an error occurs during I/Opublic void readData(java.io.DataInputStream inputStream)
throws java.io.IOException
GameDataSerializableDataInputStreamreadData in interface GameDataSerializableinputStream - The DataInputStream to read fromjava.io.IOException - Thrown if an error occurs during I/Opublic org.mini2Dx.gdx.utils.ObjectMap<java.lang.String,java.lang.String> getProperties()
public boolean containsProperty(java.lang.String propertyName)
propertyName - The property name to search forpublic java.lang.String getProperty(java.lang.String propertyName)
propertyName - The property name to search forpublic void setProperty(java.lang.String propertyName,
java.lang.String value)
propertyName - The property name to set the value forvalue - The value of the property to setpublic int getId()
public java.lang.String getName()
public void setName(java.lang.String name)
name - The name to setpublic java.lang.String getType()
public void setType(java.lang.String type)
type - public float getX()
public float getY()
public float getWidth()
public float getHeight()
public int getGid()
public void setGid(int gid)
gid - public boolean isGidFlipHorizontally()
public void setGidFlipHorizontally(boolean gidFlipHorizontally)
public boolean isGidFlipVertically()
public void setGidFlipVertically(boolean gidFlipVertically)
public boolean isGidFlipDiagonally()
public void setGidFlipDiagonally(boolean gidFlipDiagonally)
public TiledObjectShape getObjectShape()
TiledObjectShape of this objectTiledObjectShape.RECTANGLEpublic void setAsEllipse()
TiledObjectShape.ELLIPSEpublic void setAsPoint()
TiledObjectShape.POINTpublic void setAsPolygon(java.lang.String points)
TiledObjectShape.POLYGONpoints - The points in the format x1,y1 x2,y2 per the Tiled specificationpublic void setAsPolygon(float[] vertices)
TiledObjectShape.POLYGONvertices - The vertices to setpublic void setAsText(java.lang.String text,
boolean wrapText)
TiledObjectShape.TEXTtext - The text to displaywrapText - True if the text wrapspublic void setAsPolyline(java.lang.String points)
TiledObjectShape.POLYLINEpoints - The points in the format x1,y1 x2,y2 per the Tiled specificationpublic void setAsPolyline(float[] vertices)
TiledObjectShape.POLYLINEvertices - The line point verticespublic boolean isVisible()
public void setVisible(boolean visible)
public Point toPoint()
Point from this object.
Warning: If this object's shape is not TiledObjectShape.POINT, an exception will be thrown.Pointpublic Circle toCircle()
Circle from this object.
Warning: If this object's shape is not TiledObjectShape.ELLIPSE, an exception will be thrown.Circlepublic Rectangle toRectangle()
Rectangle from this object.
Warning: If this object's shape is not TiledObjectShape.RECTANGLE, an exception will be thrown.Rectanglepublic Polygon toPolygon()
Polygon from this object.
Warning: If this object's shape is not TiledObjectShape.POLYGON, an exception will be thrown.Polygonpublic org.mini2Dx.gdx.utils.Array<Point> toPolyline()
Array of Points from this object.
Warning: If this object's shape is not TiledObjectShape.POLYLINE, an exception will be thrown.Array of Points in the linepublic float[] getVertices()
public java.lang.String getText()
public boolean isWrapText()
public boolean isBuiltFromTemplate()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object