|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsource.ucregents.playground.physics.BaseEntity
public abstract class BaseEntity
The most basic type of Entity. BaseEntity contains the shape, orientation, image, as well as whether it is visible, whether it can be collided with, and what its bounciness is.
Constructor Summary | |
---|---|
BaseEntity()
Constructs a default base entity with position 0,0 and 0 height and width |
|
BaseEntity(PolygonOrCircle shape,
float orientation)
Constructs a BaseEntity with the input shape, orientation, imagelocation, and collidible and visibility properties |
Method Summary | |
---|---|
void |
calculateAxes()
Recalculates all the axes of the given shape. |
java.lang.Object |
clone()
|
protected java.lang.String |
DefaultImageLocation()
Provides the location of the default image |
void |
Deserialize(CustomXMLReader reader)
|
void |
Draw(java.awt.Graphics2D g,
boolean verbose)
Draws the entity to the screen |
java.awt.geom.Dimension2D |
getActualFrameDimensions()
Gets the dimensions of the Bounding Box |
java.util.Vector<javax.vecmath.Vector2d> |
getAxes()
Returns the vector of current axes |
java.util.Vector<javax.vecmath.Vector2d> |
getAxesClone()
Returns a clone of the vector of current axes |
javax.vecmath.Vector2d |
getAxis(int whichPolygonSide)
Determines the axis (in the form of a unit vector) which is formed by the specified side of the polygon. Note: this method DOES NOT know if there are other axes parallel to the one it is returning |
float |
getBounciness()
Accessor for the entity's bounciness |
java.awt.geom.Point2D.Double |
getCenterPoint()
Accessor for the current center point |
DrawType |
getDrawType()
|
java.util.Vector<UserEvent> |
getEvents()
Gets the user events |
java.awt.Color |
getFrameColor()
Gets the shape's current frame color |
float |
getFrictionConstant()
Gets the friction constant |
java.awt.Color |
getGradientColor()
Gets the entity's current graient color |
protected java.awt.geom.Point2D |
getImageOffset()
Gets the image offset |
java.lang.String |
getName()
Gets the name set by the user for the entity |
double |
getOrientation()
Accessor for the entity's current orientation |
java.awt.geom.Rectangle2D |
getResizingObject()
Gets the area to show resizing arrows |
double |
getRoundedShapeMass()
Gets the Shape's (PolygonOrCircle) Rounded Area and adjusts it for the mass |
double |
getScale()
Gets the current scale |
java.awt.Shape |
getShape()
Accessor for the entity's shape |
java.awt.Color |
getShapeColor()
Gets the shape's current fill color |
java.awt.geom.Rectangle2D |
getShapeFrame()
Returns the outer bounding box of the entity |
double |
getShapeMass()
Gets the Shape's (PolygonOrCircle) Area and adjusts it for use in Mass. |
java.util.Vector<javax.vecmath.Vector2d> |
getSideVectors()
Determines the vectors which connect the vertices of the entity's shape (the sides of the shape). |
java.awt.geom.Point2D.Double |
getULPoint()
Accessor for the current upper left point |
java.util.Vector<UserEvent> |
getUserEvents()
|
int |
getVertexCount()
Determines the number of vertices in the current polygon |
java.util.Vector<java.awt.geom.Point2D.Double> |
getVerticesCoordinates()
Determines the coordinates of the Vertices of the shape of this entity. |
boolean |
isCircle()
Tells whether the shape is a circle |
boolean |
isCollidable()
Determines whether or not this entity can be collided with by other entities. |
javax.vecmath.Vector2d |
isOverlapping(BaseEntity ent2)
Determines whether another polygon is overlapping another using the seperate axis theorem. |
boolean |
isPolygon()
Tells whether the shape is a polygon |
boolean |
isSelected()
Gets if this entity is selected |
boolean |
isVisible()
Determines whether or not this entity can be seen by the user. |
protected void |
OnCenterScale(double s)
|
void |
OnCollisionWith(BaseEntity ent2)
Physics collisions are already handled, this method is called immediately after each collision to determine any special behavior of this entity. |
protected void |
OnLocationChange(double deltaX,
double deltaY)
|
protected void |
OnOrientationChange(double deltaTheta)
|
protected void |
OnULScale(double s)
|
void |
RegisterEvent(int eventType,
int eventSubType,
java.lang.reflect.Method m,
java.lang.Object[] params)
|
void |
RegisterEvent(UserEvent u)
|
void |
RegisterEvents(java.util.Vector<UserEvent> ue)
|
void |
RemoveEvent(UserEvent u)
|
void |
RemoveEvents(java.util.Vector<UserEvent> ue)
|
void |
resetFrameColor()
Resets the frame color to black |
void |
Scale(double s)
Scale the shape by it's upper left point |
void |
ScaleAroundCenter(double s)
Scale the shape around it's center point |
void |
Serialize(CustomXMLWriter writer)
|
void |
setBounciness(float bounciness)
Mutator for the entitys current bounciness |
void |
setCenterPoint(double x,
double y)
Sets the center point of the entity to the given x and y coordinates |
void |
setCenterPoint(java.awt.geom.Point2D.Double p)
Sets the center point of the entity to the given point |
void |
setCollidable(boolean collide)
Sets whether the entity can collide with other entities |
void |
setDrawType(DrawType drawType)
|
void |
setFrameColor(java.awt.Color c)
Sets the shape's current frame color |
void |
setFrictionConstant(float friction)
Sets the friction constant |
void |
setGradientColor(java.awt.Color c)
Sets the entity's current gradient color |
protected void |
setImageOffset(java.awt.geom.Point2D imageOffset)
Sets the image offset |
void |
setName(java.lang.String name)
Sets the name of the entity |
void |
setOrientation(double orientation)
Mutator for the entity's orientation |
void |
setScale(double scale)
Sets the scale of the entity |
void |
setSelected(boolean b)
Set if this entity has been selected by the user |
void |
setShapeColor(java.awt.Color c)
Sets the shape's current fill color |
void |
setULPoint(double x,
double y)
Sets the upperleft point of the entity to the given x and y coordinates |
void |
setULPoint(java.awt.geom.Point2D.Double p)
Sets the upperleft point of the entity to the given double accuracy Point2D |
void |
setVisible(boolean isVisible)
Mutator for the entity's visibility |
java.lang.String |
toString()
|
org.w3c.dom.Node |
toXMLElement()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BaseEntity()
public BaseEntity(PolygonOrCircle shape, float orientation)
shape
- The shapeorientation
- The angle in degrees of its starting rotation about its center pointMethod Detail |
---|
public final void calculateAxes()
public java.lang.Object clone()
clone
in class java.lang.Object
protected java.lang.String DefaultImageLocation()
public void Deserialize(CustomXMLReader reader)
public void Draw(java.awt.Graphics2D g, boolean verbose)
g
- The java.awt.Graphics2D objectpublic final java.awt.geom.Dimension2D getActualFrameDimensions()
public final java.util.Vector<javax.vecmath.Vector2d> getAxes()
public final java.util.Vector<javax.vecmath.Vector2d> getAxesClone()
public final javax.vecmath.Vector2d getAxis(int whichPolygonSide)
whichPolygonSide
- integer referring to the side of the polygon from which the axis is extrapolated
public final float getBounciness()
public final java.awt.geom.Point2D.Double getCenterPoint()
public final DrawType getDrawType()
public java.util.Vector<UserEvent> getEvents()
public final java.awt.Color getFrameColor()
public final float getFrictionConstant()
public final java.awt.Color getGradientColor()
protected final java.awt.geom.Point2D getImageOffset()
public final java.lang.String getName()
public final double getOrientation()
public java.awt.geom.Rectangle2D getResizingObject()
public double getRoundedShapeMass()
public final double getScale()
public final java.awt.Shape getShape()
public final java.awt.Color getShapeColor()
public final java.awt.geom.Rectangle2D getShapeFrame()
public double getShapeMass()
public final java.util.Vector<javax.vecmath.Vector2d> getSideVectors()
public final java.awt.geom.Point2D.Double getULPoint()
public final java.util.Vector<UserEvent> getUserEvents()
public final int getVertexCount()
public final java.util.Vector<java.awt.geom.Point2D.Double> getVerticesCoordinates()
public final boolean isCircle()
public boolean isCollidable()
public javax.vecmath.Vector2d isOverlapping(BaseEntity ent2)
ent2
- The entity to check this one against
public final boolean isPolygon()
public final boolean isSelected()
public final boolean isVisible()
protected void OnCenterScale(double s)
public void OnCollisionWith(BaseEntity ent2)
ent2
- The entity that collision has occured withprotected void OnLocationChange(double deltaX, double deltaY)
protected void OnOrientationChange(double deltaTheta)
protected void OnULScale(double s)
public void RegisterEvent(int eventType, int eventSubType, java.lang.reflect.Method m, java.lang.Object[] params)
public void RegisterEvent(UserEvent u)
public void RegisterEvents(java.util.Vector<UserEvent> ue)
public void RemoveEvent(UserEvent u)
public void RemoveEvents(java.util.Vector<UserEvent> ue)
public final void resetFrameColor()
public final void Scale(double s)
s
- The ratio to scale it bypublic final void ScaleAroundCenter(double s)
s
- The ratio to scale it bypublic void Serialize(CustomXMLWriter writer)
public final void setBounciness(float bounciness)
bounciness
- The entity's new bounciness from 0-1public final void setCenterPoint(double x, double y)
x
- the x coordinate of the pointy
- the y coordinate of the pointpublic final void setCenterPoint(java.awt.geom.Point2D.Double p)
p
- the point to set topublic void setCollidable(boolean collide)
collide
- True if it can collide with other entitiespublic final void setDrawType(DrawType drawType)
public final void setFrameColor(java.awt.Color c)
c
- The new frame colorpublic final void setFrictionConstant(float friction)
friction
- the new friction constantpublic final void setGradientColor(java.awt.Color c)
c
- The new gradient colorprotected final void setImageOffset(java.awt.geom.Point2D imageOffset)
imageOffset
- public final void setName(java.lang.String name)
name
- name of the entitypublic final void setOrientation(double orientation)
orientation
- The orientation to be setpublic final void setScale(double scale)
scale
- the new scale of the entitypublic final void setSelected(boolean b)
b
- the isSelected valuepublic final void setShapeColor(java.awt.Color c)
c
- The new fill color of the shapepublic final void setULPoint(double x, double y)
x
- the x coordinate of the pointy
- the y coordinate of the pointpublic final void setULPoint(java.awt.geom.Point2D.Double p)
p
- the point to set the upperleft corner of the entitypublic final void setVisible(boolean isVisible)
isVisible
- Returns if the entity is currently visible or notpublic java.lang.String toString()
toString
in class java.lang.Object
public final org.w3c.dom.Node toXMLElement()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |