public abstract class Shape extends java.lang.Object implements Sizeable
| Modifier and Type | Field and Description |
|---|---|
protected Geometry |
geometry |
protected org.mini2Dx.gdx.utils.Array<PositionChangeListener> |
positionChangeListeners |
protected org.mini2Dx.gdx.utils.Array<SizeChangeListener> |
sizeChangeListeners |
| Constructor and Description |
|---|
Shape()
Constructor for shapes not belonging to the
Geometry pool |
Shape(Geometry geometry)
Constructor for shapes belonging to the
Geometry pool |
| Modifier and Type | Method and Description |
|---|---|
void |
add(float x,
float y)
Adds components to the position of this
Shape |
<T extends Positionable> |
addPostionChangeListener(PositionChangeListener<T> listener)
Adds a
Positionable to be notified of coordinate
changes |
<T extends Sizeable> |
addSizeChangeListener(SizeChangeListener<T> listener)
Adds a
SizeChangeListener to be notified of size changes |
protected void |
clearPositionChangeListeners() |
static <T extends Positionable> |
clearPositionListeners(org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners) |
static <T extends Positionable> |
clearPositionListeners(java.util.concurrent.locks.ReadWriteLock lock,
org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners) |
protected void |
clearSizeChangeListeners() |
static <T extends Sizeable> |
clearSizeListeners(org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners) |
static <T extends Sizeable> |
clearSizeListeners(java.util.concurrent.locks.ReadWriteLock lock,
org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners) |
abstract Shape |
copy()
Returns an exact copy of this
Shape |
abstract void |
dispose()
|
abstract void |
draw(Graphics g)
Draws this shape using a
Graphics instance |
abstract EdgeIterator |
edgeIterator()
Returns an
EdgeIterator for looping over the edges of this
Shape |
boolean |
equals(java.lang.Object obj) |
abstract void |
fill(Graphics g)
Fills this shape using a
Graphics instance |
float |
getDistanceTo(Positionable positionable)
Returns the distance from this
Shape to a Positionable |
abstract int |
getNumberOfSides()
Returns the number of edges of this object
|
abstract Polygon |
getPolygon()
|
abstract float |
getRotation()
Returns the rotation of this
Shape |
int |
hashCode() |
boolean |
intersects(LineSegment lineSegment)
Returns if this
Shape intersects the specified
LineSegment |
abstract boolean |
isCircle()
|
void |
moveTowards(float x,
float y,
float speed)
Moves this
Positionable towards a coordinate |
void |
moveTowards(Positionable positionable,
float speed)
Moves this
Positionable towards another Positionable |
protected void |
notifyPositionChangeListeners() |
static <T extends Positionable> |
notifyPositionListeners(org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners,
T notifier) |
static <T extends Positionable> |
notifyPositionListeners(java.util.concurrent.locks.ReadWriteLock lock,
org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners,
T notifier) |
protected void |
notifySizeChangeListeners() |
static <T extends Sizeable> |
notifySizeListeners(org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners,
T notifier) |
static <T extends Sizeable> |
notifySizeListeners(java.util.concurrent.locks.ReadWriteLock lock,
org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners,
T notifier) |
<T extends Positionable> |
removePositionChangeListener(PositionChangeListener<T> listener)
Removes a
PositionChangeListener to stop it being notified of
coordinate changes |
static <T extends Positionable> |
removePositionListener(org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners,
PositionChangeListener listener) |
static <T extends Positionable> |
removePositionListener(java.util.concurrent.locks.ReadWriteLock lock,
org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners,
PositionChangeListener listener) |
<T extends Sizeable> |
removeSizeChangeListener(SizeChangeListener<T> listener)
Removes a
SizeChangeListener to stop it being notified of size
changes |
static <T extends Sizeable> |
removeSizeListener(org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners,
SizeChangeListener listener) |
static <T extends Sizeable> |
removeSizeListener(java.util.concurrent.locks.ReadWriteLock lock,
org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners,
SizeChangeListener listener) |
abstract void |
rotate(float degrees)
Rotates this
Shape by a specified amount of degrees with its
first point as the origin |
abstract void |
rotateAround(float originX,
float originY,
float degrees)
Rotates this
Shape by a specified amount of degrees around a
specified point |
abstract void |
setRotation(float degrees)
Sets the rotation of this
Shape with its first point as the
origin |
abstract void |
setRotationAround(float originX,
float originY,
float degrees)
Sets the rotation of this
Shape with a specified point as the
origin |
void |
setRotationAround(Point center,
float degrees)
Sets the rotation of this
Shape with a specified point as the origin |
void |
subtract(float x,
float y)
Subtracts components from the position of this
Shape |
abstract void |
translate(float translateX,
float translateY)
Translates the x and y coordinate of this object
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcontains, contains, contains, getCenterX, getCenterY, getHeight, getMaxX, getMaxY, getMinX, getMinY, getWidth, intersects, intersectsLineSegment, intersectsLineSegment, scale, setCenter, setCenterX, setCenterY, setRadiusgetDistanceTo, getX, getY, setX, setXY, setYprotected final Geometry geometry
protected org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners
protected org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners
public Shape()
Geometry poolpublic abstract void dispose()
public abstract Shape copy()
ShapeShapepublic boolean intersects(LineSegment lineSegment)
Shape intersects the specified
LineSegmentintersects in interface SizeablelineSegment - The LineSegment to checkShape intersects the LineSegmentpublic float getDistanceTo(Positionable positionable)
Shape to a PositionablegetDistanceTo in interface Positionablepositionable - The Positionable to get the distance topublic void add(float x,
float y)
Shapex - The x componenty - The y componentpublic void subtract(float x,
float y)
Shapex - The x componenty - The y componentpublic abstract float getRotation()
Shapepublic abstract void setRotation(float degrees)
Shape with its first point as the
origindegrees - The rotation in degreespublic void setRotationAround(Point center, float degrees)
Shape with a specified point as the origincenter - The origin Pointdegrees - The rotation in degreespublic abstract void setRotationAround(float originX,
float originY,
float degrees)
Shape with a specified point as the
originoriginX - The origin/center x coordinateoriginY - The origin/center y coordinatedegrees - The rotation in degreespublic abstract void rotate(float degrees)
Shape by a specified amount of degrees with its
first point as the origindegrees - The rotation in degreespublic abstract void rotateAround(float originX,
float originY,
float degrees)
Shape by a specified amount of degrees around a
specified pointoriginX - The origin/center x coordinateoriginY - The origin/center y coordinatedegrees - The rotation in degreespublic abstract void draw(Graphics g)
Graphics instanceg - The Graphics context to render withpublic abstract void fill(Graphics g)
Graphics instanceg - The Graphics context to render withpublic abstract void translate(float translateX,
float translateY)
translateX - The x translation amounttranslateY - The y translation amountpublic abstract int getNumberOfSides()
getNumberOfSides in interface Sizeablepublic abstract EdgeIterator edgeIterator()
EdgeIterator for looping over the edges of this
ShapeEdgeIteratorpublic abstract boolean isCircle()
public abstract Polygon getPolygon()
getPolygon in interface SizeableShape is a Circlepublic void moveTowards(float x,
float y,
float speed)
PositionablePositionable towards a coordinatemoveTowards in interface Positionablex - The target x coordinatey - The target y coordinatespeed - The amount to move bypublic void moveTowards(Positionable positionable, float speed)
PositionablePositionable towards another PositionablemoveTowards in interface Positionablepositionable - The target Positionablespeed - The amount to move bypublic <T extends Positionable> void addPostionChangeListener(PositionChangeListener<T> listener)
PositionablePositionable to be notified of coordinate
changesaddPostionChangeListener in interface Positionablelistener - The PositionChangeListener to addPositionable.addPostionChangeListener(PositionChangeListener)public <T extends Positionable> void removePositionChangeListener(PositionChangeListener<T> listener)
PositionablePositionChangeListener to stop it being notified of
coordinate changesremovePositionChangeListener in interface Positionablelistener - The PositionChangeListener to removePositionable.removePositionChangeListener(PositionChangeListener)public <T extends Sizeable> void addSizeChangeListener(SizeChangeListener<T> listener)
SizeableSizeChangeListener to be notified of size changesaddSizeChangeListener in interface Sizeablelistener - The SizeChangeListener to addpublic <T extends Sizeable> void removeSizeChangeListener(SizeChangeListener<T> listener)
SizeableSizeChangeListener to stop it being notified of size
changesremoveSizeChangeListener in interface Sizeablelistener - The SizeChangeListener to removeprotected void notifyPositionChangeListeners()
protected void clearPositionChangeListeners()
protected void notifySizeChangeListeners()
protected void clearSizeChangeListeners()
public static <T extends Positionable> void removePositionListener(org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners, PositionChangeListener listener)
public static <T extends Positionable> void removePositionListener(java.util.concurrent.locks.ReadWriteLock lock, org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners, PositionChangeListener listener)
public static <T extends Positionable> void notifyPositionListeners(org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners, T notifier)
public static <T extends Positionable> void notifyPositionListeners(java.util.concurrent.locks.ReadWriteLock lock, org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners, T notifier)
public static <T extends Positionable> void clearPositionListeners(org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners)
public static <T extends Positionable> void clearPositionListeners(java.util.concurrent.locks.ReadWriteLock lock, org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners)
public static <T extends Sizeable> void removeSizeListener(org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners, SizeChangeListener listener)
public static <T extends Sizeable> void removeSizeListener(java.util.concurrent.locks.ReadWriteLock lock, org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners, SizeChangeListener listener)
public static <T extends Sizeable> void notifySizeListeners(org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners, T notifier)
public static <T extends Sizeable> void notifySizeListeners(java.util.concurrent.locks.ReadWriteLock lock, org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners, T notifier)
public static <T extends Sizeable> void clearSizeListeners(org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners)
public static <T extends Sizeable> void clearSizeListeners(java.util.concurrent.locks.ReadWriteLock lock, org.mini2Dx.gdx.utils.Array<SizeChangeListener> sizeChangeListeners)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object