|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.tile.Tile
com.threerings.media.tile.ObjectTile
public class ObjectTile
An object tile extends the base tile to provide support for objects whose image spans more than one unit tile.
An object tile is generally positioned based on its origin rather than the upper left of
its image. Generally this origin is in the bottom center of the object image, but can be
configured to be anywhere that the natural center point of "contact" is for the object. Note
that this does not automatically adjust the semantics of Tile.paint(java.awt.Graphics2D, int, int), it is just
expected that the caller will account for the object tile's origin when painting, if
appropriate.
An object tile has dimensions (in tile units) that represent its footprint or "shadow".
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.media.tile.Tile |
|---|
Tile.Key |
| Field Summary | |
|---|---|
protected Dimension |
_base
The object footprint width in unit tile units. |
protected String[] |
_constraints
The list of constraints associated with this object. |
protected Point |
_origin
The offset from the origin of the tile image to the object's origin or MIN_VALUE if the origin should be calculated based on the footprint. |
protected int |
_priority
This object tile's default render priority. |
protected byte |
_sorient
The orientation of the "spot" associated with this object. |
protected Point |
_spot
The coordinates of the "spot" associated with this object. |
| Fields inherited from class com.threerings.media.tile.Tile |
|---|
_mirage, _totalTileMemory, key |
| Constructor Summary | |
|---|---|
ObjectTile()
|
|
| Method Summary | |
|---|---|
int |
getBaseHeight()
Returns the object footprint height in tile units. |
int |
getBaseWidth()
Returns the object footprint width in tile units. |
String[] |
getConstraints()
Returns the list of constraints associated with this object, or null if the
object has no constraints. |
int |
getOriginX()
Returns the x offset into the tile image of the origin (which will be aligned with the bottom center of the origin tile) or Integer.MIN_VALUE if the origin is not
explicitly specified and should be computed from the image size and tile footprint. |
int |
getOriginY()
Returns the y offset into the tile image of the origin (which will be aligned with the bottom center of the origin tile) or Integer.MIN_VALUE if the origin is not
explicitly specified and should be computed from the image size and tile footprint. |
int |
getPriority()
Returns this object tile's default render priority. |
int |
getSpotOrient()
Returns the orientation of the "spot" associated with this object. |
int |
getSpotX()
Returns the x-coordinate of the "spot" associated with this object. |
int |
getSpotY()
Returns the x-coordinate of the "spot" associated with this object. |
boolean |
hasConstraint(String constraint)
Checks whether this object has the given constraint. |
boolean |
hasSpot()
Returns true if this object has a spot. |
protected void |
setBase(int width,
int height)
Sets the object footprint in tile units. |
void |
setConstraints(String[] constraints)
Configures this object's constraints. |
protected void |
setOrigin(int x,
int y)
Sets the offset in pixels from the origin of the tile image to the origin of the object. |
protected void |
setPriority(int priority)
Sets this object tile's default render priority. |
void |
setSpot(int x,
int y,
byte orient)
Configures the "spot" associated with this object. |
void |
toString(StringBuilder buf)
This should be overridden by derived classes (which should be sure to call super.toString()) to append the derived class
specific tile information to the string buffer. |
| Methods inherited from class com.threerings.media.tile.Tile |
|---|
finalize, getEstimatedMemoryUsage, getHeight, getWidth, hitTest, paint, setImage, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Dimension _base
protected Point _origin
protected int _priority
protected Point _spot
protected byte _sorient
protected String[] _constraints
| Constructor Detail |
|---|
public ObjectTile()
| Method Detail |
|---|
public int getBaseWidth()
public int getBaseHeight()
protected void setBase(int width,
int height)
public int getOriginX()
Integer.MIN_VALUE if the origin is not
explicitly specified and should be computed from the image size and tile footprint.
public int getOriginY()
Integer.MIN_VALUE if the origin is not
explicitly specified and should be computed from the image size and tile footprint.
protected void setOrigin(int x,
int y)
public int getPriority()
protected void setPriority(int priority)
public void setSpot(int x,
int y,
byte orient)
public boolean hasSpot()
public int getSpotX()
public int getSpotY()
public int getSpotOrient()
public String[] getConstraints()
null if the
object has no constraints.
public boolean hasConstraint(String constraint)
public void setConstraints(String[] constraints)
public void toString(StringBuilder buf)
Tilesuper.toString()) to append the derived class
specific tile information to the string buffer.
toString in class Tile
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||