Class: Conjuration::SceneManager

Inherits:
Object
  • Object
show all
Defined in:
lib/conjuration/managers/scene_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(window) ⇒ SceneManager

Returns a new instance of SceneManager.



5
6
7
8
# File 'lib/conjuration/managers/scene_manager.rb', line 5

def initialize(window)
  @scenes = {}
  @window = window
end

Instance Attribute Details

#current_sceneObject (readonly)

Returns the value of attribute current_scene.



18
19
20
# File 'lib/conjuration/managers/scene_manager.rb', line 18

def current_scene
  @current_scene
end

Instance Method Details

#add_scene(key, scene_class) ⇒ Object



10
11
12
# File 'lib/conjuration/managers/scene_manager.rb', line 10

def add_scene(key, scene_class)
  @scenes[key] = scene_class
end

#button_down(window, id) ⇒ Object



30
31
32
# File 'lib/conjuration/managers/scene_manager.rb', line 30

def button_down(window, id)
  current_scene.button_down(window, id)
end

#button_up(window, id) ⇒ Object



34
35
36
# File 'lib/conjuration/managers/scene_manager.rb', line 34

def button_up(window, id)
  current_scene.button_up(window, id)
end

#draw(window) ⇒ Object



26
27
28
# File 'lib/conjuration/managers/scene_manager.rb', line 26

def draw(window)
  current_scene.draw(window)
end

#set_scene(key, **options) ⇒ Object



14
15
16
# File 'lib/conjuration/managers/scene_manager.rb', line 14

def set_scene(key, **options)
  @current_scene = @scenes[key].new(@window, **options)
end

#update(window) ⇒ Object



22
23
24
# File 'lib/conjuration/managers/scene_manager.rb', line 22

def update(window)
  current_scene.update(window)
end