Sha256: ea77d10776cc3b251e6e4873f4d2b58d3d966647af93faf3dbb76fdca581453c

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

module ParticleFX2D
  module Ruby2D
    #
    # Use an instance of this class to provide
    # an _Emitter_ with a renderer factory.
    class ShapeRendererFactory
      include RendererFactory

      #
      # Instantiate a shape renderer factory.
      #
      # @param [ShapeRenderer] renderer_class Specify the object that will be used to create
      #           the particle renderers. e.g. _ParticleCircle_.
      def initialize(renderer_class)
        @renderer_class = renderer_class
      end

      # Return a particle renderer.
      #
      # @return [Renderer] for each particle
      def renderer_for(particle)
        @renderer_class.for(particle)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
particlefx2d-0.5.0 lib/particlefx2d/ruby2d/shape_renderer_factory.rb