Class: Rhythmmml::Object::Rhythm

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/rhythmmml/object.rb

Instance Attribute Summary collapse

Attributes included from Base

#x, #y

Instance Method Summary collapse

Methods included from Base

#draw_rectangle

Constructor Details

#initialize(window, x, y, info, options = {}) ⇒ Rhythm

Returns a new instance of Rhythm.



41
42
43
44
45
46
# File 'lib/rhythmmml/object.rb', line 41

def initialize(window, x, y, info, options={})
  super(window, x, y, options)
  @info = info
  @width2 = @window.width * 0.1 / 2
  @height2 = @window.height * 0.02 / 2
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



40
41
42
# File 'lib/rhythmmml/object.rb', line 40

def info
  @info
end

Instance Method Details

#drawObject



52
53
54
55
56
57
58
# File 'lib/rhythmmml/object.rb', line 52

def draw
  x1 = @x - @width2
  y1 = @y - @height2
  x2 = @x + @width2
  y2 = @y + @height2
  draw_rectangle(x1, y1, x2, y2, @color, @z_order)
end

#updateObject



48
49
50
# File 'lib/rhythmmml/object.rb', line 48

def update
  @y += 1
end