Class: Fet::Ui::NoteBox
- Inherits:
-
Object
- Object
- Fet::Ui::NoteBox
- Includes:
- NoteBoxLoopHandler
- Defined in:
- lib/fet/ui/note_box.rb
Overview
Handles drawing + events for notes
Instance Attribute Summary collapse
-
#degree_name ⇒ Object
Returns the value of attribute degree_name.
-
#note_boxes ⇒ Object
Returns the value of attribute note_boxes.
-
#selected ⇒ Object
Returns the value of attribute selected.
Attributes included from NoteBoxLoopHandler
Instance Method Summary collapse
- #correct? ⇒ Boolean
- #degree_index ⇒ Object
-
#initialize(note_boxes:, degree_name:) ⇒ NoteBox
constructor
A new instance of NoteBox.
- #start ⇒ Object
Methods included from NoteBoxLoopHandler
#handle_event_loop, #handle_update_loop, #manually_select
Constructor Details
#initialize(note_boxes:, degree_name:) ⇒ NoteBox
Returns a new instance of NoteBox.
15 16 17 18 |
# File 'lib/fet/ui/note_box.rb', line 15 def initialize(note_boxes:, degree_name:) self.note_boxes = note_boxes self.degree_name = degree_name end |
Instance Attribute Details
#degree_name ⇒ Object
Returns the value of attribute degree_name.
13 14 15 |
# File 'lib/fet/ui/note_box.rb', line 13 def degree_name @degree_name end |
#note_boxes ⇒ Object
Returns the value of attribute note_boxes.
13 14 15 |
# File 'lib/fet/ui/note_box.rb', line 13 def note_boxes @note_boxes end |
#selected ⇒ Object
Returns the value of attribute selected.
13 14 15 |
# File 'lib/fet/ui/note_box.rb', line 13 def selected @selected end |
Instance Method Details
#correct? ⇒ Boolean
30 31 32 |
# File 'lib/fet/ui/note_box.rb', line 30 def correct? return note_boxes.level.degree_indices.include?(degree_index) end |
#degree_index ⇒ Object
34 35 36 |
# File 'lib/fet/ui/note_box.rb', line 34 def degree_index degree_instance.degree_index end |
#start ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/fet/ui/note_box.rb', line 20 def start self.keyboard_accidental = "" self.square ||= generate_square self.text ||= generate_text self.selected = false self.user_selected = false self.note_music = generate_note_music update_colors end |