Class: Rhythmmml::Object::Rhythm
- Inherits:
-
Object
- Object
- Rhythmmml::Object::Rhythm
- Includes:
- Base
- Defined in:
- lib/rhythmmml/object.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
Attributes included from Base
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(window, x, y, info, options = {}) ⇒ Rhythm
constructor
A new instance of Rhythm.
- #update ⇒ Object
Methods included from Base
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, ={}) super(window, x, y, ) @info = info @width2 = @window.width * 0.1 / 2 @height2 = @window.height * 0.02 / 2 end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
40 41 42 |
# File 'lib/rhythmmml/object.rb', line 40 def info @info end |
Instance Method Details
#draw ⇒ Object
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 |
#update ⇒ Object
48 49 50 |
# File 'lib/rhythmmml/object.rb', line 48 def update @y += 1 end |