Module: ParticleFX2D::Ruby2D::ShapeRenderer
- Includes:
- ParticleFX2D::Renderer
- Included in:
- ParticleCircle, ParticleImage
- Defined in:
- lib/particlefx2d/ruby2d/shape_renderer.rb
Overview
The base definition for a Ruby2D shape-based renderer that can be peered to a particle managed by the ParticleFX2D Emitter. Include this when defining Ruby2D shape-specific classes to provide the Emitter to render the particle.
This approach requires a shape per particle.
Instance Method Summary collapse
-
#draw_particle(particle) ⇒ Object
Updates the shape’s properties; no explicit drawing needed.
-
#hide_particle(_particle) ⇒ Object
Hide the particle.
-
#show_particle(_particle) ⇒ Object
Show the particle.
Methods included from ParticleFX2D::Renderer
Instance Method Details
#draw_particle(particle) ⇒ Object
Updates the shape’s properties; no explicit drawing needed.
25 26 27 28 |
# File 'lib/particlefx2d/ruby2d/shape_renderer.rb', line 25 def draw_particle(particle) center!(particle.x, particle.y) color!(particle.color) end |
#hide_particle(_particle) ⇒ Object
Hide the particle. Used when a particle is deactivated.
20 21 22 |
# File 'lib/particlefx2d/ruby2d/shape_renderer.rb', line 20 def hide_particle(_particle) remove end |
#show_particle(_particle) ⇒ Object
Show the particle. Used when a particle is activated.
15 16 17 |
# File 'lib/particlefx2d/ruby2d/shape_renderer.rb', line 15 def show_particle(_particle) add end |