|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.particles.Particle
public class Particle
A single particle within a system
Field Summary | |
---|---|
protected Color |
color
The colour of the particle |
protected static SGL |
GL
The renderer to use for all GL operations |
protected Image |
image
The image for this particle |
static int |
INHERIT_POINTS
Indicates the particle should inherit it's use of points |
protected float |
life
The life left in the particle |
protected boolean |
oriented
True if this particle's quad should be oritented based on it's direction |
protected float |
originalLife
The original life of this particle |
protected float |
scaleY
The currently scalar applied on the y axis |
protected float |
size
The current size in pixels of the particle |
protected int |
type
The type identifier of this particle |
static int |
USE_POINTS
Indicates the particle should explicitly use points |
static int |
USE_QUADS
Indicates the particle should explicitly not use points |
protected int |
usePoints
How this particle should be rendered |
protected float |
velx
The x component of the direction vector of the particle |
protected float |
vely
The y component of the direction vector of the particle |
protected float |
x
The x coordinate of the particle |
protected float |
y
The y coordinate of the particle |
Constructor Summary | |
---|---|
Particle(ParticleSystem engine)
Create a new particle belonging to given engine |
Method Summary | |
---|---|
void |
adjustColor(float r,
float g,
float b,
float a)
Adjust (add) the color of the particle |
void |
adjustColor(int r,
int g,
int b,
int a)
Adjust (add) the color of the particle |
void |
adjustLife(float delta)
Adjust the life othe particle |
void |
adjustPosition(float dx,
float dy)
Adjust (add) the position of this particle |
void |
adjustSize(float delta)
Adjust the size of the particle |
void |
adjustVelocity(float dx,
float dy)
Adjust (add) the direction of this particle |
Color |
getColor()
Get the color of this particle |
ParticleEmitter |
getEmitter()
Get the emitter that owns this particle |
float |
getLife()
Get the life remaining in the particle in milliseconds |
float |
getOriginalLife()
Get the original life of this particle |
float |
getScaleY()
Get the current scalar applied on the y axis |
float |
getSize()
Get the size of this particle |
int |
getType()
Get the type of this particle |
float |
getX()
Get the x offset of this particle |
float |
getY()
Get the y offset of this particle |
void |
init(ParticleEmitter emitter,
float life)
Initialise the state of the particle as it's reused |
boolean |
inUse()
Check if this particle is currently in use (i.e. |
boolean |
isOriented()
Check if this particle is being oriented based on it's velocity |
void |
kill()
Kill the particle, stop it rendering and send it back to the engine for use. |
void |
move(float x,
float y)
Move this particle a fixed amount |
void |
render()
Render this particle |
void |
setColor(float r,
float g,
float b,
float a)
Set the color of the particle |
void |
setImage(Image image)
Set the image used to render this particle |
void |
setLife(float life)
Set the life of the particle |
void |
setOriented(boolean oriented)
Indicate if this particle should be oriented based on it's velocity |
void |
setPosition(float x,
float y)
Set the position of this particle |
void |
setScaleY(float scaleY)
Set the current scalar applied on the y axis |
void |
setSize(float size)
Set the size of the particle |
void |
setSpeed(float speed)
Set the current speed of this particle |
void |
setType(int type)
Set the type of this particle |
void |
setUsePoint(int usePoints)
Indicate how this particle should be renered |
void |
setVelocity(float velx,
float vely)
Set the velocity of the particle |
void |
setVelocity(float dirx,
float diry,
float speed)
Set the velocity of the particle |
java.lang.String |
toString()
|
void |
update(int delta)
Update the state of this particle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static SGL GL
public static final int INHERIT_POINTS
public static final int USE_POINTS
public static final int USE_QUADS
protected float x
protected float y
protected float velx
protected float vely
protected float size
protected Color color
protected float life
protected float originalLife
protected Image image
protected int type
protected int usePoints
protected boolean oriented
protected float scaleY
Constructor Detail |
---|
public Particle(ParticleSystem engine)
engine
- The engine the new particle belongs toMethod Detail |
---|
public float getX()
public float getY()
public void move(float x, float y)
x
- The amount to move the particle on the horizontal axisy
- The amount to move the particle on the vertical axispublic float getSize()
public Color getColor()
public void setImage(Image image)
image
- The image used to render this particlepublic float getOriginalLife()
public float getLife()
public boolean inUse()
public void render()
public void update(int delta)
delta
- The time since the last updatepublic void init(ParticleEmitter emitter, float life)
emitter
- The emitter controlling this particlelife
- The life the particle should have (in milliseconds)public void setType(int type)
type
- The type of this particlepublic void setUsePoint(int usePoints)
usePoints
- The indicator for renderingUSE_POINTS
,
USE_QUADS
,
INHERIT_POINTS
public int getType()
public void setSize(float size)
size
- The size of the particle (in pixels)public void adjustSize(float delta)
delta
- The amount to adjust the size by (in pixels)public void setLife(float life)
life
- The life of the particle in millisecondspublic void adjustLife(float delta)
delta
- The amount to adjust the particle by (in milliseconds)public void kill()
public void setColor(float r, float g, float b, float a)
r
- The red component of the colorg
- The green component of the colorb
- The blue component of the colora
- The alpha component of the colorpublic void setPosition(float x, float y)
x
- The new x position of the particley
- The new y position of the particlepublic void setVelocity(float dirx, float diry, float speed)
dirx
- The x component of the new velocitydiry
- The y component of the new velocityspeed
- The speed in the given directionpublic void setSpeed(float speed)
speed
- The speed of this particlepublic void setVelocity(float velx, float vely)
velx
- The x component of the new velocityvely
- The y component of the new velocitypublic void adjustPosition(float dx, float dy)
dx
- The amount to adjust the x component bydy
- The amount to adjust the y component bypublic void adjustColor(float r, float g, float b, float a)
r
- The amount to adjust the red component byg
- The amount to adjust the green component byb
- The amount to adjust the blue component bya
- The amount to adjust the alpha component bypublic void adjustColor(int r, int g, int b, int a)
r
- The amount to adjust the red component byg
- The amount to adjust the green component byb
- The amount to adjust the blue component bya
- The amount to adjust the alpha component bypublic void adjustVelocity(float dx, float dy)
dx
- The amount to adjust the x component bydy
- The amount to adjust the y component bypublic ParticleEmitter getEmitter()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean isOriented()
public void setOriented(boolean oriented)
oriented
- True if this particle is being oriented based on it's velocitypublic float getScaleY()
public void setScaleY(float scaleY)
scaleY
- The new scalar to apply on the y axis
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |