Class: ParticleFX2D::Ruby2D::ShapeRendererFactory

Inherits:
Object
  • Object
show all
Includes:
ParticleFX2D::RendererFactory
Defined in:
lib/particlefx2d/ruby2d/shape_renderer_factory.rb

Overview

Use an instance of this class to provide an Emitter with a renderer factory.

Instance Method Summary collapse

Methods included from ParticleFX2D::RendererFactory

#on_update_end, #on_update_start

Constructor Details

#initialize(renderer_class) ⇒ ShapeRendererFactory

Instantiate a shape renderer factory.

Parameters:

  • renderer_class (ShapeRenderer)

    Specify the object that will be used to create the particle renderers. e.g. ParticleCircle.



16
17
18
# File 'lib/particlefx2d/ruby2d/shape_renderer_factory.rb', line 16

def initialize(renderer_class)
  @renderer_class = renderer_class
end

Instance Method Details

#renderer_for(particle) ⇒ Renderer

Return a particle renderer.

Returns:



23
24
25
# File 'lib/particlefx2d/ruby2d/shape_renderer_factory.rb', line 23

def renderer_for(particle)
  @renderer_class.for(particle)
end