Class: SDC::Scene
- Inherits:
-
Object
- Object
- SDC::Scene
- Defined in:
- lib/core/Scene.rb
Instance Method Summary collapse
-
#at_exit ⇒ Object
This method gets called if the scene gets replaced by another scene or nil.
-
#at_init ⇒ Object
This method gets called directly when the scene is created.
-
#create(entity_class) ⇒ Object
Other helper methods.
-
#draw ⇒ Object
This method gets called once every tick, use it for drawing.
-
#draw_imgui ⇒ Object
This method draws an ImGui overlay after the initial drawing procedure.
-
#each_event ⇒ Object
Helper method to execute events as a block.
-
#handle_event(event) ⇒ Object
Use this method to handle a single event (e.g. check its type and value).
-
#initialize ⇒ Scene
constructor
Methods for internal stuff, don't change these if inherited.
- #main_draw ⇒ Object
- #main_update ⇒ Object
- #process_events ⇒ Object
-
#update ⇒ Object
This method gets called once every tick, use it for game logic.
Constructor Details
#initialize ⇒ Scene
Methods for internal stuff, don't change these if inherited
7 8 9 |
# File 'lib/core/Scene.rb', line 7 def initialize at_init end |
Instance Method Details
#at_exit ⇒ Object
This method gets called if the scene gets replaced by another scene or nil
54 55 56 |
# File 'lib/core/Scene.rb', line 54 def at_exit end |
#at_init ⇒ Object
This method gets called directly when the scene is created
49 50 51 |
# File 'lib/core/Scene.rb', line 49 def at_init end |
#create(entity_class) ⇒ Object
Other helper methods
42 43 44 |
# File 'lib/core/Scene.rb', line 42 def create(entity_class) return entity_class.new end |
#draw ⇒ Object
This method gets called once every tick, use it for drawing
64 65 66 |
# File 'lib/core/Scene.rb', line 64 def draw end |
#draw_imgui ⇒ Object
This method draws an ImGui overlay after the initial drawing procedure
69 70 71 |
# File 'lib/core/Scene.rb', line 69 def draw_imgui end |
#each_event ⇒ Object
Helper method to execute events as a block
34 35 36 37 38 |
# File 'lib/core/Scene.rb', line 34 def each_event while event = SDC.window.poll_event do yield event end end |
#handle_event(event) ⇒ Object
Use this method to handle a single event (e.g. check its type and value)
74 75 76 |
# File 'lib/core/Scene.rb', line 74 def handle_event(event) end |
#main_draw ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/core/Scene.rb', line 15 def main_draw SDC.window.clear draw if SDC.window.imgui_defined? then SDC.window.imgui_update draw_imgui end SDC.window.render_and_display end |
#main_update ⇒ Object
11 12 13 |
# File 'lib/core/Scene.rb', line 11 def main_update update end |
#process_events ⇒ Object
27 28 29 30 31 |
# File 'lib/core/Scene.rb', line 27 def process_events each_event do |event| handle_event(event) end end |
#update ⇒ Object
This method gets called once every tick, use it for game logic
59 60 61 |
# File 'lib/core/Scene.rb', line 59 def update end |