Class: SDC::Scene

Inherits:
Object
  • Object
show all
Defined in:
lib/core/Scene.rb

Instance Method Summary collapse

Constructor Details

#initializeScene

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_exitObject

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_initObject

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

#drawObject

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_imguiObject

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_eventObject

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_drawObject



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_updateObject



11
12
13
# File 'lib/core/Scene.rb', line 11

def main_update
	update
end

#process_eventsObject



27
28
29
30
31
# File 'lib/core/Scene.rb', line 27

def process_events
	each_event do |event|
		handle_event(event)
	end
end

#updateObject

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