Class: Fet::Ui::Game
- Inherits:
-
Object
- Object
- Fet::Ui::Game
- Includes:
- GameLoopHandler, GameSetupHelper
- Defined in:
- lib/fet/ui/game.rb
Overview
Holds the state of the current game
Instance Attribute Summary collapse
-
#key_type ⇒ Object
Returns the value of attribute key_type.
-
#level ⇒ Object
Returns the value of attribute level.
-
#limit_degrees ⇒ Object
Returns the value of attribute limit_degrees.
-
#next_on_correct ⇒ Object
Returns the value of attribute next_on_correct.
-
#note_range ⇒ Object
Returns the value of attribute note_range.
-
#number_of_degrees ⇒ Object
Returns the value of attribute number_of_degrees.
-
#score ⇒ Object
Returns the value of attribute score.
-
#tempo ⇒ Object
Returns the value of attribute tempo.
-
#timer ⇒ Object
Returns the value of attribute timer.
-
#tmp_directory ⇒ Object
Returns the value of attribute tmp_directory.
Instance Method Summary collapse
-
#initialize(tempo:, degrees:, key_type:, next_on_correct:, limit_degrees: []) ⇒ Game
constructor
A new instance of Game.
- #start ⇒ Object
- #stop ⇒ Object
Methods included from GameLoopHandler
#handle_event_loop, #handle_update_loop, #set_level_complete_event_flag, #set_level_started_event_flag, #set_note_selected_event_flag
Constructor Details
#initialize(tempo:, degrees:, key_type:, next_on_correct:, limit_degrees: []) ⇒ Game
Returns a new instance of Game.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fet/ui/game.rb', line 21 def initialize(tempo:, degrees:, key_type:, next_on_correct:, limit_degrees: []) self.note_range = Fet::REDUCED_BY_OCTAVE_PIANO_RANGE self.tempo = tempo self.key_type = key_type self.number_of_degrees = degrees self.next_on_correct = next_on_correct self.limit_degrees = limit_degrees self.tmp_directory = Dir.mktmpdir initialize_ui_objects validate! setup_window end |
Instance Attribute Details
#key_type ⇒ Object
Returns the value of attribute key_type.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def key_type @key_type end |
#level ⇒ Object
Returns the value of attribute level.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def level @level end |
#limit_degrees ⇒ Object
Returns the value of attribute limit_degrees.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def limit_degrees @limit_degrees end |
#next_on_correct ⇒ Object
Returns the value of attribute next_on_correct.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def next_on_correct @next_on_correct end |
#note_range ⇒ Object
Returns the value of attribute note_range.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def note_range @note_range end |
#number_of_degrees ⇒ Object
Returns the value of attribute number_of_degrees.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def number_of_degrees @number_of_degrees end |
#score ⇒ Object
Returns the value of attribute score.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def score @score end |
#tempo ⇒ Object
Returns the value of attribute tempo.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def tempo @tempo end |
#timer ⇒ Object
Returns the value of attribute timer.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def timer @timer end |
#tmp_directory ⇒ Object
Returns the value of attribute tmp_directory.
18 19 20 |
# File 'lib/fet/ui/game.rb', line 18 def tmp_directory @tmp_directory end |
Instance Method Details
#start ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/fet/ui/game.rb', line 34 def start score.start level.start timer.start show_window Fet::ScoreSummary.add_entry(self) end |
#stop ⇒ Object
42 43 44 |
# File 'lib/fet/ui/game.rb', line 42 def stop close_window end |