org.newdawn.slick.particles
Class ConfigurableEmitter

java.lang.Object
  extended by org.newdawn.slick.particles.ConfigurableEmitter
All Implemented Interfaces:
ParticleEmitter

public class ConfigurableEmitter
extends java.lang.Object
implements ParticleEmitter

An emitter than can be externally configured. This configuration can also be saved/loaded using the ParticleIO class.

Author:
kevin
See Also:
ParticleIO

Nested Class Summary
 class ConfigurableEmitter.ColorRecord
          A single element in the colour range of this emitter
 class ConfigurableEmitter.LinearInterpolator
          A value computed based on linear interpolation between a set of points
 class ConfigurableEmitter.RandomValue
          A configurable simple linear random value
 class ConfigurableEmitter.Range
          A simple bean describing a range of values
 class ConfigurableEmitter.SimpleValue
          A configurable simple single value
static interface ConfigurableEmitter.Value
          a general interface to provide a general value :]
 
Field Summary
protected  boolean adjust
          True if we need to adjust particles for movement
protected  float adjustx
          The amount to adjust on the x axis
protected  float adjusty
          The amount to adjust on the y axis
 ConfigurableEmitter.LinearInterpolator alpha
          Whiskas - Interpolated value for alpha
 ConfigurableEmitter.SimpleValue angularOffset
          The angular offset
 java.util.ArrayList colors
          The color range
protected  boolean completed
          True if the system has completed due to a wrap up
 ConfigurableEmitter.Range emitCount
          The number of particles that will be emitted
 ConfigurableEmitter.SimpleValue endAlpha
          The ending alpha value
 ConfigurableEmitter.SimpleValue gravityFactor
          The factor of gravity to apply
 ConfigurableEmitter.SimpleValue growthFactor
          The growth factor on the particles
 java.lang.String imageName
          The name of the image in use
 ConfigurableEmitter.Range initialDistance
          The initial distance of the particles
 ConfigurableEmitter.Range initialLife
          The initial life of the new pixels
 ConfigurableEmitter.Range initialSize
          The initial size of the new pixels
 ConfigurableEmitter.Range length
          The length of the effect
 java.lang.String name
          The name attribute
 ConfigurableEmitter.LinearInterpolator scaleY
          Whiskas - Interpolated value for y axis scaling
 ConfigurableEmitter.LinearInterpolator size
          Whiskas - Interpolated value for size
 ConfigurableEmitter.Range spawnCount
          The spawn count property - how many particles are spawned each time
 ConfigurableEmitter.Range spawnInterval
          The spawn interval range property - how often spawn happens
 ConfigurableEmitter.Range speed
          The speed particles fly out
 ConfigurableEmitter.RandomValue spread
          The spread of the particles
 ConfigurableEmitter.SimpleValue startAlpha
          The starting alpha value
 boolean useAdditive
          True if the additivie blending mode should be used for particles owned by this emitter
 boolean useOriented
          True if the quads should be orieted based on velocity
 int usePoints
          The points indicate
 ConfigurableEmitter.LinearInterpolator velocity
          Whiskas - Interpolated value for velocity
 ConfigurableEmitter.SimpleValue windFactor
          The factor of wind to apply
protected  boolean wrapUp
          True if we're wrapping up
 ConfigurableEmitter.Range xOffset
          The offset from the x position
 ConfigurableEmitter.Range yOffset
          The offset from the y position
 
Constructor Summary
ConfigurableEmitter(java.lang.String name)
          Create a new emitter configurable externally
 
Method Summary
 void addColorPoint(float pos, Color col)
          Add a point in the colour cycle
 boolean completed()
          Check if this emitter has completed it's cycle
 ConfigurableEmitter duplicate()
          Create a duplicate of this emitter.
 Image getImage()
          Get the image to draw for each particle
 java.lang.String getImageName()
          The name of the image to load
 float getX()
          Get the base x coordiante for spawning particles
 float getY()
          Get the base y coordiante for spawning particles
 boolean isEnabled()
          Check if the emitter is enabled
 boolean isOriented()
          Check if the particles produced should maintain orientation
 void replay()
          Cause the emitter to replay it's circle
 void replayCheck()
          Check if the replay has died out - used by the editor
 void reset()
          Release all the particles held by this emitter
 void resetState()
          Clear the state of emitter back to default
 void setEnabled(boolean enabled)
          Indicate whether the emitter should be enabled
 void setImageName(java.lang.String imageName)
          Set the name of the image to use on a per particle basis.
 void setPosition(float x, float y)
          Set the position of this particle source
 void setPosition(float x, float y, boolean moveParticles)
          Set the position of this particle source
static void setRelativePath(java.lang.String path)
          Set the path from which images should be loaded
 java.lang.String toString()
           
 void update(ParticleSystem system, int delta)
          Update the emitter, produce any particles required by requesting them from the particle system provided.
 void updateParticle(Particle particle, int delta)
          Update a single particle that this emitter produced
 boolean useAdditive()
          Check if this emitter should use additive blending
 boolean usePoints(ParticleSystem system)
          Check if this emitter should use points based on it's own settings and those of the particle system
 void wrapUp()
          Wrap up the particle emitter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

spawnInterval

public ConfigurableEmitter.Range spawnInterval
The spawn interval range property - how often spawn happens


spawnCount

public ConfigurableEmitter.Range spawnCount
The spawn count property - how many particles are spawned each time


initialLife

public ConfigurableEmitter.Range initialLife
The initial life of the new pixels


initialSize

public ConfigurableEmitter.Range initialSize
The initial size of the new pixels


xOffset

public ConfigurableEmitter.Range xOffset
The offset from the x position


yOffset

public ConfigurableEmitter.Range yOffset
The offset from the y position


spread

public ConfigurableEmitter.RandomValue spread
The spread of the particles


angularOffset

public ConfigurableEmitter.SimpleValue angularOffset
The angular offset


initialDistance

public ConfigurableEmitter.Range initialDistance
The initial distance of the particles


speed

public ConfigurableEmitter.Range speed
The speed particles fly out


growthFactor

public ConfigurableEmitter.SimpleValue growthFactor
The growth factor on the particles


gravityFactor

public ConfigurableEmitter.SimpleValue gravityFactor
The factor of gravity to apply


windFactor

public ConfigurableEmitter.SimpleValue windFactor
The factor of wind to apply


length

public ConfigurableEmitter.Range length
The length of the effect


colors

public java.util.ArrayList colors
The color range

See Also:
ConfigurableEmitter.ColorRecord

startAlpha

public ConfigurableEmitter.SimpleValue startAlpha
The starting alpha value


endAlpha

public ConfigurableEmitter.SimpleValue endAlpha
The ending alpha value


alpha

public ConfigurableEmitter.LinearInterpolator alpha
Whiskas - Interpolated value for alpha


size

public ConfigurableEmitter.LinearInterpolator size
Whiskas - Interpolated value for size


velocity

public ConfigurableEmitter.LinearInterpolator velocity
Whiskas - Interpolated value for velocity


scaleY

public ConfigurableEmitter.LinearInterpolator scaleY
Whiskas - Interpolated value for y axis scaling


emitCount

public ConfigurableEmitter.Range emitCount
The number of particles that will be emitted


usePoints

public int usePoints
The points indicate


useOriented

public boolean useOriented
True if the quads should be orieted based on velocity


useAdditive

public boolean useAdditive
True if the additivie blending mode should be used for particles owned by this emitter


name

public java.lang.String name
The name attribute


imageName

public java.lang.String imageName
The name of the image in use


wrapUp

protected boolean wrapUp
True if we're wrapping up


completed

protected boolean completed
True if the system has completed due to a wrap up


adjust

protected boolean adjust
True if we need to adjust particles for movement


adjustx

protected float adjustx
The amount to adjust on the x axis


adjusty

protected float adjusty
The amount to adjust on the y axis

Constructor Detail

ConfigurableEmitter

public ConfigurableEmitter(java.lang.String name)
Create a new emitter configurable externally

Parameters:
name - The name of emitter
Method Detail

setRelativePath

public static void setRelativePath(java.lang.String path)
Set the path from which images should be loaded

Parameters:
path - The path from which images should be loaded

setImageName

public void setImageName(java.lang.String imageName)
Set the name of the image to use on a per particle basis. The complete reference to the image is required (based on the relative path)

Parameters:
imageName - The name of the image to use on a per particle reference
See Also:
setRelativePath(String)

getImageName

public java.lang.String getImageName()
The name of the image to load

Returns:
The name of the image to load

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

setPosition

public void setPosition(float x,
                        float y)
Set the position of this particle source

Parameters:
x - The x coodinate of that this emitter should spawn at
y - The y coodinate of that this emitter should spawn at

setPosition

public void setPosition(float x,
                        float y,
                        boolean moveParticles)
Set the position of this particle source

Parameters:
x - The x coodinate of that this emitter should spawn at
y - The y coodinate of that this emitter should spawn at
moveParticles - True if particles should be moved with the emitter

getX

public float getX()
Get the base x coordiante for spawning particles

Returns:
The x coordinate for spawning particles

getY

public float getY()
Get the base y coordiante for spawning particles

Returns:
The y coordinate for spawning particles

isEnabled

public boolean isEnabled()
Description copied from interface: ParticleEmitter
Check if the emitter is enabled

Specified by:
isEnabled in interface ParticleEmitter
Returns:
True if the emitter is enabled
See Also:
ParticleEmitter.isEnabled()

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: ParticleEmitter
Indicate whether the emitter should be enabled

Specified by:
setEnabled in interface ParticleEmitter
Parameters:
enabled - True if the emitter should be enabled
See Also:
ParticleEmitter.setEnabled(boolean)

update

public void update(ParticleSystem system,
                   int delta)
Description copied from interface: ParticleEmitter
Update the emitter, produce any particles required by requesting them from the particle system provided.

Specified by:
update in interface ParticleEmitter
Parameters:
system - The particle system used to create particles
delta - The amount of time in milliseconds since last emitter update
See Also:
ParticleEmitter.update(org.newdawn.slick.particles.ParticleSystem, int)

updateParticle

public void updateParticle(Particle particle,
                           int delta)
Description copied from interface: ParticleEmitter
Update a single particle that this emitter produced

Specified by:
updateParticle in interface ParticleEmitter
Parameters:
particle - The particle to be updated
delta - The amount of time in millisecond since last particle update
See Also:
ParticleEmitter.updateParticle(org.newdawn.slick.particles.Particle, int)

completed

public boolean completed()
Check if this emitter has completed it's cycle

Specified by:
completed in interface ParticleEmitter
Returns:
True if the emitter has completed it's cycle

replay

public void replay()
Cause the emitter to replay it's circle


reset

public void reset()
Release all the particles held by this emitter


replayCheck

public void replayCheck()
Check if the replay has died out - used by the editor


duplicate

public ConfigurableEmitter duplicate()
Create a duplicate of this emitter. The duplicate should be added to a ParticleSystem to be used.

Returns:
a copy if no IOException occurred, null otherwise

addColorPoint

public void addColorPoint(float pos,
                          Color col)
Add a point in the colour cycle

Parameters:
pos - The position in the life cycle (0 = start, 1 = end)
col - The color applied at this position

useAdditive

public boolean useAdditive()
Description copied from interface: ParticleEmitter
Check if this emitter should use additive blending

Specified by:
useAdditive in interface ParticleEmitter
Returns:
True if the emitter should use the right blending

isOriented

public boolean isOriented()
Description copied from interface: ParticleEmitter
Check if the particles produced should maintain orientation

Specified by:
isOriented in interface ParticleEmitter
Returns:
True if the particles produced should maintain orientation

usePoints

public boolean usePoints(ParticleSystem system)
Description copied from interface: ParticleEmitter
Check if this emitter should use points based on it's own settings and those of the particle system

Specified by:
usePoints in interface ParticleEmitter
Parameters:
system - The particle system to cross check agianst
Returns:
True if we should use points

getImage

public Image getImage()
Description copied from interface: ParticleEmitter
Get the image to draw for each particle

Specified by:
getImage in interface ParticleEmitter
Returns:
The image to draw for each particle

wrapUp

public void wrapUp()
Description copied from interface: ParticleEmitter
Wrap up the particle emitter. This means the emitter will no longer produce particles and will be marked as completed once the particles have expired

Specified by:
wrapUp in interface ParticleEmitter

resetState

public void resetState()
Description copied from interface: ParticleEmitter
Clear the state of emitter back to default

Specified by:
resetState in interface ParticleEmitter


Copyright © 2006 New Dawn Software. All Rights Reserved.