metro 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/metro/event_relay.rb +197 -28
- data/lib/metro/game/dsl.rb +5 -1
- data/lib/metro/game.rb +4 -0
- data/lib/metro/scene.rb +137 -84
- data/lib/metro/scene_view/drawers/artists_block.rb +17 -0
- data/lib/metro/scene_view/drawers/composite_drawer.rb +81 -0
- data/lib/metro/scene_view/drawers/drawer.rb +115 -0
- data/lib/metro/scene_view/drawers/image.rb +30 -0
- data/lib/metro/scene_view/{components → drawers}/label.rb +5 -0
- data/lib/metro/scene_view/{components → drawers}/select.rb +10 -2
- data/lib/metro/scene_view/json_view.rb +21 -1
- data/lib/metro/scene_view/no_view.rb +12 -1
- data/lib/metro/scene_view/scene_view.rb +34 -4
- data/lib/metro/scene_view/yaml_view.rb +18 -1
- data/lib/metro/scenes.rb +53 -11
- data/lib/metro/version.rb +1 -1
- data/lib/metro/window.rb +35 -8
- data/lib/metro.rb +21 -3
- metadata +8 -6
- data/lib/metro/scene_view/components/drawer.rb +0 -44
- data/lib/metro/scene_view/components/unsupported_component.rb +0 -9
@@ -1,44 +0,0 @@
|
|
1
|
-
module Metro
|
2
|
-
module SceneView
|
3
|
-
class Drawer
|
4
|
-
|
5
|
-
# The window is necessary as all drawing elements created require
|
6
|
-
# an access to this instance.
|
7
|
-
attr_reader :window
|
8
|
-
|
9
|
-
# The scene is necessary to ensure that any fields which contain
|
10
|
-
# variables within the application are properly interpolated.
|
11
|
-
attr_reader :scene
|
12
|
-
|
13
|
-
def initialize(scene)
|
14
|
-
@scene = scene
|
15
|
-
@window = scene.window
|
16
|
-
after_initialize
|
17
|
-
end
|
18
|
-
|
19
|
-
def after_initialize ; end
|
20
|
-
|
21
|
-
def components
|
22
|
-
@components ||= begin
|
23
|
-
Hash.new(UnsupportedComponent).merge label: Label.new(scene),
|
24
|
-
select: Select.new(scene)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
#
|
29
|
-
# Render all the view elements defined that are supported by this drawer.
|
30
|
-
#
|
31
|
-
def draw(view)
|
32
|
-
view.each do |name,content|
|
33
|
-
component = content['type'].to_sym
|
34
|
-
components[component].draw(content)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
require_relative 'unsupported_component'
|
43
|
-
require_relative 'label'
|
44
|
-
require_relative 'select'
|