Class Generator

java.lang.Object
tripleplay.particle.Generator

public abstract class Generator extends Object
Adds particles to an emitter according to some policy.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Generator
    A generator that emits no particles and is never exhausted.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Generator
    constant(float particlesPerSecond)
    Returns a generator that emits the specified number of particles per second, and is never exhausted.
    abstract boolean
    generate(Emitter emitter, float now, float dt)
    Requests that particles be generated, if appropriate.
    static Generator
    impulse(int particles)
    Returns a generator that emits the specified number of particles all at once, and is then immediately exhausted.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NOOP

      public static Generator NOOP
      A generator that emits no particles and is never exhausted.
  • Constructor Details

    • Generator

      public Generator()
  • Method Details

    • impulse

      public static Generator impulse(int particles)
      Returns a generator that emits the specified number of particles all at once, and is then immediately exhausted.
    • constant

      public static Generator constant(float particlesPerSecond)
      Returns a generator that emits the specified number of particles per second, and is never exhausted. The number of particles may be fractional if you wish to emit one particle every N seconds where N is greater than 1.
    • generate

      public abstract boolean generate(Emitter emitter, float now, float dt)
      Requests that particles be generated, if appropriate.
      Parameters:
      emitter - the emitter for which the particles should be generated.
      now - the current time stamp (in seconds).
      dt - the elapsed time since the last frame (in seconds).
      Returns:
      true if this generator is exhausted, false if it has more particles to generate.