Sha256: 6a58903b61643be5a34a895477f9150cce4413c74a31ec471092056183007e6f

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

require_relative '../renderer_factory'

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

2 entries across 2 versions & 1 rubygems

Version Path
particlefx2d-0.4.0 lib/particlefx2d/ruby2d/shape_renderer_factory.rb
particlefx2d-0.3.0 lib/particlefx2d/ruby2d/shape_renderer_factory.rb