Class: ShatteredController::Runner
- Inherits:
-
Object
- Object
- ShatteredController::Runner
- Defined in:
- lib/runner.rb
Overview
The class Runner is present in model, view, and controller, and signifies the main entry point into the program. This is called by script/runner.rb
Class Method Summary collapse
Instance Method Summary collapse
- #each_frame ⇒ Object
-
#initialize(options = {}) ⇒ Runner
constructor
:nodoc:.
-
#start_game ⇒ Object
Every time this exits, a game dies.
Constructor Details
#initialize(options = {}) ⇒ Runner
:nodoc:
6 7 8 9 |
# File 'lib/runner.rb', line 6 def initialize( = {} ) @@environment ||= @@environment[:input] = ShatteredController::KeyConverter.new(@@environment[:input]) end |
Class Method Details
.environment ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/runner.rb', line 20 def self.environment begin return @@environment rescue NameError return mock_environment end end |
.mock_environment ⇒ Object
27 28 29 30 31 |
# File 'lib/runner.rb', line 27 def self.mock_environment retv = {} retv[:camera] = MockCamera.new return retv end |
Instance Method Details
#each_frame ⇒ Object
17 18 19 |
# File 'lib/runner.rb', line 17 def each_frame yield @@environment[:renderer].timeSinceLastFrame while @@environment[:renderer].nextFrame end |
#start_game ⇒ Object
Every time this exits, a game dies.
11 12 13 14 15 16 |
# File 'lib/runner.rb', line 11 def start_game each_frame do |time_elapsed| @@environment[:state].update_timers(time_elapsed) @@environment[:input].flush end end |