Class: GameboxApp
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#game ⇒ Object
readonly
Returns the value of attribute game.
Class Method Summary collapse
- .post_setup_handlers ⇒ Object
- .register_post_setup_handler(handler) ⇒ Object
- .run(argv, env) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ GameboxApp
constructor
A new instance of GameboxApp.
- #main_loop ⇒ Object
- #setup(argv, env) ⇒ Object
- #shutdown ⇒ Object
- #start(argv, env) ⇒ Object
Constructor Details
#initialize ⇒ GameboxApp
Returns a new instance of GameboxApp.
17 18 19 |
# File 'lib/gamebox/gamebox_application.rb', line 17 def initialize @context = Conject.default_object_context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
11 12 13 |
# File 'lib/gamebox/gamebox_application.rb', line 11 def context @context end |
#game ⇒ Object (readonly)
Returns the value of attribute game.
11 12 13 |
# File 'lib/gamebox/gamebox_application.rb', line 11 def game @game end |
Class Method Details
.post_setup_handlers ⇒ Object
45 46 47 |
# File 'lib/gamebox/gamebox_application.rb', line 45 def self.post_setup_handlers @post_setup_handlers ||= [ ] end |
.register_post_setup_handler(handler) ⇒ Object
41 42 43 |
# File 'lib/gamebox/gamebox_application.rb', line 41 def self.register_post_setup_handler(handler) post_setup_handlers.push handler end |
.run(argv, env) ⇒ Object
13 14 15 |
# File 'lib/gamebox/gamebox_application.rb', line 13 def self.run(argv,env) GameboxApp.new.start argv, env end |
Instance Method Details
#main_loop ⇒ Object
33 34 35 36 37 |
# File 'lib/gamebox/gamebox_application.rb', line 33 def main_loop @input_manager = @context[:input_manager] @input_manager.register @game @input_manager.show end |
#setup(argv, env) ⇒ Object
27 28 29 30 31 |
# File 'lib/gamebox/gamebox_application.rb', line 27 def setup(argv,env) @game = @context[:game] @game.configure self.class.post_setup_handlers.each { |handler| handler.setup(argv, env, @context[:config_manager]) } end |
#shutdown ⇒ Object
39 |
# File 'lib/gamebox/gamebox_application.rb', line 39 def shutdown ; end |
#start(argv, env) ⇒ Object
21 22 23 24 25 |
# File 'lib/gamebox/gamebox_application.rb', line 21 def start(argv,env) setup(argv,env) main_loop shutdown end |