public abstract class Particle extends java.lang.Object implements ITimeToLive
| Constructor and Description |
|---|
Particle(float width,
float height,
java.awt.Color color,
int ttl)
Constructs a new particle.
|
| Modifier and Type | Method and Description |
|---|---|
java.awt.geom.Point2D |
getAbsoluteLocation(java.awt.geom.Point2D effectLocation) |
protected float |
getAbsoluteX(java.awt.geom.Point2D emitterOrigin) |
protected float |
getAbsoluteY(java.awt.geom.Point2D emitterOrigin) |
long |
getAliveTime() |
java.awt.geom.Rectangle2D |
getBoundingBox(java.awt.geom.Point2D origin) |
CollisionType |
getCollisionType() |
java.awt.Color |
getColor() |
int |
getColorAlpha() |
RenderType |
getCustomRenderType() |
float |
getDeltaHeight() |
float |
getDeltaWidth() |
float |
getDx() |
float |
getDy() |
float |
getGravityX() |
float |
getGravityY() |
float |
getHeight() |
protected float |
getOpacity() |
java.awt.geom.Point2D |
getRenderLocation(java.awt.geom.Point2D effectLocation)
Gets the location relative to the specified effect location.
|
int |
getTimeToLive() |
float |
getWidth() |
float |
getX() |
float |
getY() |
boolean |
isContinuousCollisionEnabled() |
boolean |
isFading() |
boolean |
isFadingOnCollision() |
abstract void |
render(java.awt.Graphics2D g,
java.awt.geom.Point2D emitterOrigin) |
Particle |
setCollisionType(CollisionType collisionType) |
Particle |
setColor(java.awt.Color color) |
Particle |
setColorAlpha(int colorAlpha)
Sets the color alpha.
|
Particle |
setContinuousCollision(boolean ccd)
Enabling this check can be very performance hungry and should be used with caution and only for a small amount of particles.
|
Particle |
setCustomRenderType(RenderType renderType) |
Particle |
setDeltaHeight(float deltaHeight) |
Particle |
setDeltaIncX(float gravityX) |
Particle |
setDeltaIncY(float gravityY) |
Particle |
setDeltaWidth(float deltaWidth) |
Particle |
setDeltaX(float dx) |
Particle |
setDeltaY(float dy) |
Particle |
setFade(boolean fade) |
Particle |
setFadeOnCollision(boolean fadeOnCollision) |
Particle |
setHeight(float height) |
Particle |
setWidth(float width) |
Particle |
setX(float x) |
Particle |
setY(float y) |
boolean |
timeToLiveReached() |
void |
update(java.awt.geom.Point2D emitterOrigin,
float updateRatio)
Updates the effect's position, change in xCurrent, change in yCurrent,
remaining lifetime, and color.
|
boolean |
usesCustomRenderType() |
public Particle(float width,
float height,
java.awt.Color color,
int ttl)
width - the widthheight - the heightttl - The remaining time to live of the particle.color - The color of the effect.public long getAliveTime()
getAliveTime in interface ITimeToLivepublic java.awt.geom.Rectangle2D getBoundingBox(java.awt.geom.Point2D origin)
public CollisionType getCollisionType()
public java.awt.Color getColor()
public int getColorAlpha()
public float getDeltaHeight()
public float getDeltaWidth()
public float getDx()
public float getDy()
public float getGravityX()
public float getGravityY()
public float getHeight()
public java.awt.geom.Point2D getRenderLocation(java.awt.geom.Point2D effectLocation)
effectLocation - the effect positionpublic RenderType getCustomRenderType()
public int getTimeToLive()
getTimeToLive in interface ITimeToLivepublic float getWidth()
public float getX()
public float getY()
public boolean isFading()
public boolean isFadingOnCollision()
public boolean isContinuousCollisionEnabled()
public abstract void render(java.awt.Graphics2D g,
java.awt.geom.Point2D emitterOrigin)
public Particle setCollisionType(CollisionType collisionType)
public Particle setContinuousCollision(boolean ccd)
ccd - If set to true, the collision will be checked continuously by a ray-cast approximation.public Particle setColor(java.awt.Color color)
public Particle setColorAlpha(int colorAlpha)
colorAlpha - the new color alphaParticle instance to chain further setter calls.public Particle setDeltaHeight(float deltaHeight)
public Particle setDeltaIncX(float gravityX)
public Particle setDeltaIncY(float gravityY)
public Particle setDeltaWidth(float deltaWidth)
public Particle setDeltaX(float dx)
public Particle setDeltaY(float dy)
public Particle setFade(boolean fade)
public Particle setFadeOnCollision(boolean fadeOnCollision)
public Particle setHeight(float height)
public Particle setCustomRenderType(RenderType renderType)
public Particle setWidth(float width)
public Particle setX(float x)
public Particle setY(float y)
public boolean timeToLiveReached()
timeToLiveReached in interface ITimeToLivepublic void update(java.awt.geom.Point2D emitterOrigin,
float updateRatio)
emitterOrigin - The current Emitter originupdateRatio - The update ratio for this particle.public java.awt.geom.Point2D getAbsoluteLocation(java.awt.geom.Point2D effectLocation)
protected float getAbsoluteX(java.awt.geom.Point2D emitterOrigin)
protected float getAbsoluteY(java.awt.geom.Point2D emitterOrigin)
protected float getOpacity()
public boolean usesCustomRenderType()