Class: BeltsEngine::Game
- Inherits:
-
Object
- Object
- BeltsEngine::Game
- Includes:
- ToolsManager, BeltsSupport::Configuration
- Defined in:
- lib/belts_engine/game.rb
Instance Method Summary collapse
-
#initialize ⇒ Game
constructor
A new instance of Game.
- #start ⇒ Object
- #update ⇒ Object
- #use(extension) ⇒ Object
Methods included from ToolsManager
#register_tool, #respond_to?, #tools
Constructor Details
#initialize ⇒ Game
Returns a new instance of Game.
6 7 8 9 10 11 12 13 14 |
# File 'lib/belts_engine/game.rb', line 6 def initialize register_tool(:time, Tools::Time.new) register_tool(:input, Tools::Input.new) register_tool(:window, Tools::Window.new) register_tool(:collections, Ecs::CollectionManager.new) register_tool(:entities, Ecs::EntityManager.new(self)) register_tool(:scenes, Tools::SceneManager.new(self)) register_tool(:systems, Ecs::SystemManager.new(self)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BeltsEngine::ToolsManager
Instance Method Details
#start ⇒ Object
20 21 22 23 24 25 |
# File 'lib/belts_engine/game.rb', line 20 def start main_scene_class = config.main_scene.to_s.constantize raise 'Main scene not specified' unless main_scene_class scenes.load_scene(main_scene_class) end |
#update ⇒ Object
27 28 29 30 |
# File 'lib/belts_engine/game.rb', line 27 def update time.update systems.update end |
#use(extension) ⇒ Object
16 17 18 |
# File 'lib/belts_engine/game.rb', line 16 def use(extension) extension.install(self) end |