metro 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.md +8 -0
- data/lib/assets/missing.ogg +0 -0
- data/lib/commands/thor.rb +11 -5
- data/lib/locale/en.yml +8 -0
- data/lib/metro.rb +2 -3
- data/lib/metro/missing_scene.rb +7 -7
- data/lib/metro/models/properties/song_property.rb +1 -1
- data/lib/metro/scenes.rb +0 -12
- data/lib/metro/version.rb +1 -1
- data/lib/metro/views/yaml_view.rb +1 -1
- data/lib/templates/game/assets/hero.png +0 -0
- data/lib/templates/game/models/hero.rb +20 -0
- data/lib/templates/game/scenes/first_scene.rb +11 -0
- data/lib/templates/game/scenes/game_scene.rb +3 -3
- data/lib/templates/game/views/brand.yaml +2 -3
- data/lib/templates/game/views/brand_to_title.yaml +3 -3
- data/lib/templates/game/views/first.yaml +14 -0
- data/lib/templates/game/views/title.yaml +4 -6
- data/lib/templates/model.rb.tt +13 -0
- data/lib/templates/scene.rb.tt +9 -7
- data/lib/templates/view.yaml.tt +9 -6
- metadata +13 -10
- data/lib/assets/missing.mp3 +0 -0
- data/lib/templates/game/models/game_model.rb +0 -3
data/changelog.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Metro
|
2
2
|
|
3
|
+
## 0.2.3 / 2012-11-11
|
4
|
+
|
5
|
+
* FIX metro generators and templates generating out-of-date formats
|
6
|
+
* FIX YAML views wil now return an empty hash instead of false on empty files
|
7
|
+
* Added first scene and model to template.
|
8
|
+
* FIX better error message when a directory is specified
|
9
|
+
* Added the `g` generator shortcut: `metro g scene NAME`
|
10
|
+
|
3
11
|
## 0.2.2 / 2012-11-10
|
4
12
|
|
5
13
|
* Song support added (scene methods and model properties)
|
Binary file
|
data/lib/commands/thor.rb
CHANGED
@@ -48,19 +48,25 @@ module Metro
|
|
48
48
|
|
49
49
|
end
|
50
50
|
|
51
|
-
desc "new
|
52
|
-
"Create a new game within the directory using with the
|
51
|
+
desc "new GAMENAME",
|
52
|
+
"Create a new game within the directory using with the GAMENAME given."
|
53
53
|
def new(game_name)
|
54
54
|
Metro::GenerateGame.start [ game_name ]
|
55
55
|
end
|
56
56
|
|
57
|
-
desc "generate",
|
58
|
-
"Create a new
|
57
|
+
desc "generate TYPE NAME",
|
58
|
+
"Create a new type: model, view, or scene."
|
59
59
|
def generate(type,name)
|
60
60
|
gen = generator(type)
|
61
61
|
gen.start [ name ]
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
|
+
desc "g TYPE NAME",
|
65
|
+
"Create a new type: model, view, or scene."
|
66
|
+
def g(type,name)
|
67
|
+
generate(type,name)
|
68
|
+
end
|
69
|
+
|
64
70
|
desc "help", "This commoand"
|
65
71
|
def help
|
66
72
|
say banner
|
data/lib/locale/en.yml
CHANGED
@@ -8,6 +8,14 @@ en:
|
|
8
8
|
actions:
|
9
9
|
- "Ensure you have specified the correct file"
|
10
10
|
- "Ensure that the file exists at that location"
|
11
|
+
- "Did you mean to generate a new game, scene, or model? Try: `metro help`"
|
12
|
+
specified_directory:
|
13
|
+
title: "Path specified is a directory"
|
14
|
+
message: "The specified path is a `%{directory}` and not a valid Metro game file."
|
15
|
+
actions:
|
16
|
+
- "Ensure you have specified the correct file"
|
17
|
+
- "Specify the path to the metro game file with the directory included."
|
18
|
+
- "Did you mean to generate a new game, scene, or model? Try: `metro help`"
|
11
19
|
reserved_control_name:
|
12
20
|
title: "Unable to define control: %{name}"
|
13
21
|
message: "The specified control name `%{name}` is RESERVED or ALREADY DEFINED."
|
data/lib/metro.rb
CHANGED
@@ -159,9 +159,8 @@ module Metro
|
|
159
159
|
|
160
160
|
|
161
161
|
def game_file_exists?(file)
|
162
|
-
unless File.exists?
|
163
|
-
|
164
|
-
end
|
162
|
+
error!("error.missing_metro_file",file: file) unless File.exists?(file)
|
163
|
+
error!("error.specified_directory",directory: file) if File.directory?(file)
|
165
164
|
end
|
166
165
|
|
167
166
|
end
|
data/lib/metro/missing_scene.rb
CHANGED
@@ -7,15 +7,15 @@ module Metro
|
|
7
7
|
end
|
8
8
|
|
9
9
|
draw :title, text: "Missing Scene!",
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
position: "20,20,1",
|
11
|
+
color: "rgb(255,0,0)",
|
12
|
+
font: {size: 80},
|
13
13
|
model: "metro::models::label"
|
14
|
-
|
14
|
+
|
15
15
|
draw :message, text: 'The scene `#{self.class.missing_scene}` was requested, but is missing!',
|
16
|
-
|
17
|
-
color:
|
16
|
+
position: "20,100,1",
|
17
|
+
color: "rgb(255,255,255)",
|
18
18
|
model: "metro::models::label"
|
19
19
|
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
data/lib/metro/scenes.rb
CHANGED
@@ -114,18 +114,6 @@ module Metro
|
|
114
114
|
@scenes_hash ||= hash_with_missing_scene_default
|
115
115
|
end
|
116
116
|
|
117
|
-
#
|
118
|
-
# Generate a map from the scene or scenes to include all the sub-classes of
|
119
|
-
# these scenes.
|
120
|
-
#
|
121
|
-
# @param [Scene,Array<Scene>] scenes a scene or scene subclass or an array of
|
122
|
-
# scene subclasses.
|
123
|
-
#
|
124
|
-
# @see #scenes_hash
|
125
|
-
#
|
126
|
-
def build_map_of_scenes(scenes)
|
127
|
-
end
|
128
|
-
|
129
117
|
#
|
130
118
|
# Create a hash that will return a setup missing scene by default.
|
131
119
|
#
|
data/lib/metro/version.rb
CHANGED
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Hero < Metro::Model
|
2
|
+
|
3
|
+
property :image, path: "hero.png"
|
4
|
+
|
5
|
+
property :position
|
6
|
+
property :angle
|
7
|
+
property :move_amount, default: 1.5
|
8
|
+
|
9
|
+
event :on_hold, KbLeft, GpLeft do
|
10
|
+
self.position -= move_amount
|
11
|
+
end
|
12
|
+
|
13
|
+
event :on_hold, KbRight, GpRight do
|
14
|
+
self.angle += move_amount
|
15
|
+
end
|
16
|
+
|
17
|
+
def draw
|
18
|
+
image.draw_rot(x,y,z_order,angle.to_f)
|
19
|
+
end
|
20
|
+
end
|
@@ -20,11 +20,11 @@ class GameScene < Metro::Scene
|
|
20
20
|
# @example Setting up the ability for all subclassed scenes
|
21
21
|
# to be edited with the 'Ctrl+E' event
|
22
22
|
#
|
23
|
-
event :on_up,
|
23
|
+
event :on_up, KbE do |event|
|
24
24
|
if event.control?
|
25
|
-
transition_to scene_name, with: edit
|
25
|
+
transition_to scene_name, with: :edit
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
|
30
|
-
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
instruction: &instruction
|
2
|
+
model: metro::models::label
|
3
|
+
font:
|
4
|
+
name: Arial
|
5
|
+
size: 40
|
6
|
+
color: "rgba(255,255,0)"
|
7
|
+
first_instruction:
|
8
|
+
<<: *instruction
|
9
|
+
text: "<- to move left |"
|
10
|
+
position: "60,300,1"
|
11
|
+
second_instruction:
|
12
|
+
<<: *instruction
|
13
|
+
text: "| to move right ->"
|
14
|
+
position: "320,300,1"
|
@@ -1,12 +1,10 @@
|
|
1
1
|
title:
|
2
2
|
model: metro::models::label
|
3
3
|
text: "#{Game.name}"
|
4
|
-
|
5
|
-
|
4
|
+
font:
|
5
|
+
size: 40
|
6
|
+
position: "320,100,1"
|
6
7
|
color: rgba(255,255,255,1.0)
|
7
8
|
menu:
|
8
9
|
model: metro::models::menu
|
9
|
-
|
10
|
-
y: 200
|
11
|
-
color: rgb(127,127,127)
|
12
|
-
highlight-color: rgb(255,255,255)
|
10
|
+
position: "260,200,1"
|
data/lib/templates/model.rb.tt
CHANGED
@@ -34,6 +34,8 @@ class <%= model_name %> < GameModel
|
|
34
34
|
#
|
35
35
|
# @see Metro::Model::AnimationProperty
|
36
36
|
# @see Metro::Model::ImageProperty
|
37
|
+
# @see Metro::Model::SongProperty
|
38
|
+
# @see Metro::Model::SampleProperty
|
37
39
|
# @see Metro::Model::NumericProperty
|
38
40
|
# @see Metro::Model::ScaleProperty
|
39
41
|
# @see Metro::Model::TextProperty
|
@@ -89,6 +91,17 @@ class <%= model_name %> < GameModel
|
|
89
91
|
#
|
90
92
|
def after_initialize ; end
|
91
93
|
|
94
|
+
#
|
95
|
+
# This method is called right after the model has been added to the scene and added
|
96
|
+
# to the window.
|
97
|
+
#
|
98
|
+
def show ; end
|
99
|
+
|
100
|
+
#
|
101
|
+
# This is called every update interval while the window is being shown.
|
102
|
+
#
|
103
|
+
def update ; end
|
104
|
+
|
92
105
|
#
|
93
106
|
# This is called after every {#update} and when the OS wants the window to
|
94
107
|
# repaint itself.
|
data/lib/templates/scene.rb.tt
CHANGED
@@ -3,16 +3,18 @@ class <%= scene_class_name %> < GameScene
|
|
3
3
|
# but that can be overriden with the scene_name class method
|
4
4
|
# scene_name "credits"
|
5
5
|
|
6
|
+
draw :title
|
7
|
+
|
6
8
|
#
|
7
9
|
# DRAWING and ACTORS
|
8
10
|
#
|
9
11
|
# @example Explicitly drawing a text label in the scene
|
10
12
|
#
|
11
|
-
# draw :title,
|
12
|
-
# '
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
13
|
+
# draw :title, text: 'Title Screen',
|
14
|
+
# position: '20,20,0',
|
15
|
+
# font: { size: 60 },
|
16
|
+
# color: 'rgb(255,255,255)',
|
17
|
+
# model: 'metro::models::label'
|
16
18
|
#
|
17
19
|
# The draw method can be simplier for models that have content defined
|
18
20
|
# for them in the view or the models themselves define the appropriate
|
@@ -21,7 +23,7 @@ class <%= scene_class_name %> < GameScene
|
|
21
23
|
# @example defining multiple things to draw; their visual data would be
|
22
24
|
# stored within the respective view file
|
23
25
|
#
|
24
|
-
# draws :
|
26
|
+
# draws :title, :hero, :enemy
|
25
27
|
#
|
26
28
|
|
27
29
|
#
|
@@ -114,4 +116,4 @@ class <%= scene_class_name %> < GameScene
|
|
114
116
|
def prepare_transition_from(old_scene) ; end
|
115
117
|
|
116
118
|
|
117
|
-
end
|
119
|
+
end
|
data/lib/templates/view.yaml.tt
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
# http://www.yaml.org/YAML_for_ruby.html
|
2
|
+
---
|
3
|
+
title:
|
4
|
+
model: "metro::models::label"
|
5
|
+
text: "Your Scene"
|
6
|
+
position: "190,200,4"
|
7
|
+
font:
|
8
|
+
size: 60
|
9
|
+
color: "rgba(255,255,0,1.0)"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gosu
|
@@ -110,7 +110,7 @@ files:
|
|
110
110
|
- Rakefile
|
111
111
|
- bin/metro
|
112
112
|
- changelog.md
|
113
|
-
- lib/assets/missing.
|
113
|
+
- lib/assets/missing.ogg
|
114
114
|
- lib/assets/missing.png
|
115
115
|
- lib/assets/missing.wav
|
116
116
|
- lib/assets/missing_animation.png
|
@@ -199,14 +199,17 @@ files:
|
|
199
199
|
- lib/metro/window.rb
|
200
200
|
- lib/templates/game/README.md.tt
|
201
201
|
- lib/templates/game/assets/brand.jpg
|
202
|
+
- lib/templates/game/assets/hero.png
|
202
203
|
- lib/templates/game/metro.tt
|
203
|
-
- lib/templates/game/models/
|
204
|
+
- lib/templates/game/models/hero.rb
|
204
205
|
- lib/templates/game/scenes/brand_scene.rb
|
205
206
|
- lib/templates/game/scenes/brand_to_title_scene.rb
|
207
|
+
- lib/templates/game/scenes/first_scene.rb
|
206
208
|
- lib/templates/game/scenes/game_scene.rb
|
207
209
|
- lib/templates/game/scenes/title_scene.rb
|
208
210
|
- lib/templates/game/views/brand.yaml
|
209
211
|
- lib/templates/game/views/brand_to_title.yaml
|
212
|
+
- lib/templates/game/views/first.yaml
|
210
213
|
- lib/templates/game/views/title.yaml
|
211
214
|
- lib/templates/message.erb
|
212
215
|
- lib/templates/model.rb.tt
|
@@ -234,12 +237,12 @@ licenses: []
|
|
234
237
|
post_install_message: ! " ______ ___ _____\n ___ |/ /_____ __ /_______________\n
|
235
238
|
\ __ /|_/ / _ _ \\_ __/__ ___/_ __ \\\n _ / / / / __// /_ _ / /
|
236
239
|
/_/ /\n /_/ /_/ \\___/ \\__/ /_/ \\____/\n\n Thank you for installing
|
237
|
-
metro 0.2.
|
238
|
-
\ Changes:\n \n *
|
239
|
-
\
|
240
|
-
|
241
|
-
|
242
|
-
|
240
|
+
metro 0.2.3 / 2012-11-11.\n ---------------------------------------------------------------------\n
|
241
|
+
\ Changes:\n \n * FIX metro generators and templates generating out-of-date
|
242
|
+
formats\n * FIX YAML views wil now return an empty hash instead of false on empty
|
243
|
+
files\n * Added first scene and model to template.\n * FIX better error message
|
244
|
+
when a directory is specified\n * Added the `g` generator shortcut: `metro g scene
|
245
|
+
NAME`\n \n\n ---------------------------------------------------------------------\n"
|
243
246
|
rdoc_options: []
|
244
247
|
require_paths:
|
245
248
|
- lib
|
data/lib/assets/missing.mp3
DELETED
Binary file
|