Class: ParticleSprite

Inherits:
Sprite
  • Object
show all
Defined in:
lib/rubysketch/solitaire/common/particle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, *args, rgb: [255], alpha: 255, **kwargs, &block) ⇒ ParticleSprite

Returns a new instance of ParticleSprite.



51
52
53
54
55
56
57
58
# File 'lib/rubysketch/solitaire/common/particle.rb', line 51

def initialize(owner, *args, rgb: [255], alpha: 255, **kwargs, &block)
  @owner, @rgb, @alpha = owner, rgb, alpha
  super(*args, **kwargs, &block)
  draw do |&draw|
    fill *@rgb, @alpha
    draw.call
  end
end

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



60
61
62
# File 'lib/rubysketch/solitaire/common/particle.rb', line 60

def alpha
  @alpha
end

#rgbObject

Returns the value of attribute rgb.



60
61
62
# File 'lib/rubysketch/solitaire/common/particle.rb', line 60

def rgb
  @rgb
end

Instance Method Details

#deleteObject



67
68
69
# File 'lib/rubysketch/solitaire/common/particle.rb', line 67

def delete()
  @owner.delete self
end

#frame=(frame) ⇒ Object



62
63
64
65
# File 'lib/rubysketch/solitaire/common/particle.rb', line 62

def frame=(frame)
  self.pos  = frame[0, 2]
  self.size = frame[2, 2]
end