metro 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +2 -0
- data/README.md +18 -19
- data/changelog.md +5 -1
- data/lib/core_ext/numeric.rb +17 -0
- data/lib/metro.rb +8 -3
- data/lib/metro/animation/on_update_operation.rb +7 -7
- data/lib/metro/events/event_relay.rb +43 -1
- data/lib/metro/events/event_state_manager.rb +7 -0
- data/lib/metro/image.rb +13 -0
- data/lib/metro/models/model.rb +12 -2
- data/lib/metro/models/properties/options_property/options.rb +4 -0
- data/lib/metro/models/ui/physics_sprite.rb +105 -0
- data/lib/metro/models/ui/space.rb +152 -0
- data/lib/metro/models/ui/sprite.rb +2 -2
- data/lib/metro/models/ui/tile_map.rb +133 -0
- data/lib/metro/models/ui/tmx/isometric_position.rb +43 -0
- data/lib/metro/models/ui/tmx/orthogonal_position.rb +15 -0
- data/lib/metro/models/ui/tmx/tile_layer.rb +78 -0
- data/lib/metro/models/ui/ui.rb +3 -0
- data/lib/metro/scene.rb +2 -1
- data/lib/metro/units/rectangle_bounds.rb +75 -5
- data/lib/metro/version.rb +4 -4
- data/lib/metro/window.rb +1 -0
- data/lib/templates/game/assets/missing.png +0 -0
- data/lib/tmx_ext/object.rb +61 -0
- data/lib/tmx_ext/object_shape.rb +93 -0
- data/lib/tmx_ext/tile_set.rb +41 -0
- data/metro.gemspec +3 -1
- data/metro.png +0 -0
- data/spec/core_ext/numeric_spec.rb +28 -0
- data/spec/metro/image_spec.rb +33 -0
- data/spec/metro/units/rectangle_bounds_spec.rb +56 -0
- data/spec/tmx_ext/object_spec.rb +49 -0
- data/spec/tmx_ext/tile_set_spec.rb +24 -0
- metadata +56 -27
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Tmx::Object do
|
4
|
+
context "when created with standard parameters" do
|
5
|
+
|
6
|
+
let(:object) do
|
7
|
+
Tmx::Object.new points: points, type: "rock"
|
8
|
+
end
|
9
|
+
|
10
|
+
#
|
11
|
+
# These are the points as they are currently defined
|
12
|
+
# in the TMX gem for a poly shape
|
13
|
+
#
|
14
|
+
let(:points) { ["320,448", "1248,448", "1248,480", "320,480"] }
|
15
|
+
|
16
|
+
describe "#body" do
|
17
|
+
let(:body) { object.body }
|
18
|
+
|
19
|
+
it "has infinite mass" do
|
20
|
+
expect(body.m).to eq Float::INFINITY
|
21
|
+
end
|
22
|
+
|
23
|
+
it "has infinite moment of interia" do
|
24
|
+
expect(body.i).to eq Float::INFINITY
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#shape" do
|
29
|
+
let(:shape) { object.shape }
|
30
|
+
|
31
|
+
it "body should be the same body" do
|
32
|
+
expect(shape.body).to eq object.body
|
33
|
+
end
|
34
|
+
|
35
|
+
it "has correct collision type" do
|
36
|
+
expect(shape.collision_type).to eq :rock
|
37
|
+
end
|
38
|
+
|
39
|
+
it "not a sensor" do
|
40
|
+
expect(shape).to_not be_sensor
|
41
|
+
end
|
42
|
+
|
43
|
+
it "has no elasticity" do
|
44
|
+
expect(shape.e).to eq 0.0
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Tmx::TileSet do
|
4
|
+
|
5
|
+
let(:window) { stub('window') }
|
6
|
+
|
7
|
+
let(:subject) do
|
8
|
+
tile_set = described_class.new tilewidth: 10, tileheight: 20,
|
9
|
+
margin: 2, spacing: 2, image: "tile_image.png"
|
10
|
+
tile_set.window = window
|
11
|
+
tile_set
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#images" do
|
15
|
+
let(:raw_images) { [ mock("image-1"), mock("image-2") ] }
|
16
|
+
|
17
|
+
it "returns an array of images" do
|
18
|
+
subject.should_receive(:raw_image_tiles).and_return(raw_images)
|
19
|
+
subject.should_receive(:crop_image).twice
|
20
|
+
subject.images
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Franklin Webber
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: gosu
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,15 +20,41 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: texplay
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tmx
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.2
|
30
55
|
- !ruby/object:Gem::Dependency
|
31
56
|
name: thor
|
32
57
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
58
|
requirements:
|
35
59
|
- - ~>
|
36
60
|
- !ruby/object:Gem::Version
|
@@ -38,7 +62,6 @@ dependencies:
|
|
38
62
|
type: :runtime
|
39
63
|
prerelease: false
|
40
64
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
65
|
requirements:
|
43
66
|
- - ~>
|
44
67
|
- !ruby/object:Gem::Version
|
@@ -46,7 +69,6 @@ dependencies:
|
|
46
69
|
- !ruby/object:Gem::Dependency
|
47
70
|
name: i18n
|
48
71
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
72
|
requirements:
|
51
73
|
- - ~>
|
52
74
|
- !ruby/object:Gem::Version
|
@@ -54,15 +76,13 @@ dependencies:
|
|
54
76
|
type: :runtime
|
55
77
|
prerelease: false
|
56
78
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
79
|
requirements:
|
59
80
|
- - ~>
|
60
81
|
- !ruby/object:Gem::Version
|
61
82
|
version: 0.6.1
|
62
83
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
84
|
+
name: activesupport
|
64
85
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
86
|
requirements:
|
67
87
|
- - ~>
|
68
88
|
- !ruby/object:Gem::Version
|
@@ -70,7 +90,6 @@ dependencies:
|
|
70
90
|
type: :runtime
|
71
91
|
prerelease: false
|
72
92
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
93
|
requirements:
|
75
94
|
- - ~>
|
76
95
|
- !ruby/object:Gem::Version
|
@@ -78,7 +97,6 @@ dependencies:
|
|
78
97
|
- !ruby/object:Gem::Dependency
|
79
98
|
name: listen
|
80
99
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
100
|
requirements:
|
83
101
|
- - ~>
|
84
102
|
- !ruby/object:Gem::Version
|
@@ -86,7 +104,6 @@ dependencies:
|
|
86
104
|
type: :runtime
|
87
105
|
prerelease: false
|
88
106
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
107
|
requirements:
|
91
108
|
- - ~>
|
92
109
|
- !ruby/object:Gem::Version
|
@@ -94,7 +111,6 @@ dependencies:
|
|
94
111
|
- !ruby/object:Gem::Dependency
|
95
112
|
name: rspec
|
96
113
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
114
|
requirements:
|
99
115
|
- - ~>
|
100
116
|
- !ruby/object:Gem::Version
|
@@ -102,7 +118,6 @@ dependencies:
|
|
102
118
|
type: :development
|
103
119
|
prerelease: false
|
104
120
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
121
|
requirements:
|
107
122
|
- - ~>
|
108
123
|
- !ruby/object:Gem::Version
|
@@ -111,7 +126,7 @@ description: ! " Metro is a 2D Gaming framework built around gosu (game devel
|
|
111
126
|
library).\n Metro makes it easy to create games by enforcing common conceptual
|
112
127
|
structures\n and conventions.\n"
|
113
128
|
email:
|
114
|
-
-
|
129
|
+
- franklin.webber@gmail.com
|
115
130
|
executables:
|
116
131
|
- metro
|
117
132
|
extensions: []
|
@@ -208,8 +223,14 @@ files:
|
|
208
223
|
- lib/metro/models/ui/menu.rb
|
209
224
|
- lib/metro/models/ui/model_label.rb
|
210
225
|
- lib/metro/models/ui/model_labeler.rb
|
226
|
+
- lib/metro/models/ui/physics_sprite.rb
|
211
227
|
- lib/metro/models/ui/rectangle.rb
|
228
|
+
- lib/metro/models/ui/space.rb
|
212
229
|
- lib/metro/models/ui/sprite.rb
|
230
|
+
- lib/metro/models/ui/tile_map.rb
|
231
|
+
- lib/metro/models/ui/tmx/isometric_position.rb
|
232
|
+
- lib/metro/models/ui/tmx/orthogonal_position.rb
|
233
|
+
- lib/metro/models/ui/tmx/tile_layer.rb
|
213
234
|
- lib/metro/models/ui/ui.rb
|
214
235
|
- lib/metro/parameters/command_line_args_parser.rb
|
215
236
|
- lib/metro/parameters/options.rb
|
@@ -248,6 +269,7 @@ files:
|
|
248
269
|
- lib/templates/game/README.md.tt
|
249
270
|
- lib/templates/game/assets/brand.jpg
|
250
271
|
- lib/templates/game/assets/hero.png
|
272
|
+
- lib/templates/game/assets/missing.png
|
251
273
|
- lib/templates/game/lib/custom_easing.rb
|
252
274
|
- lib/templates/game/metro.tt
|
253
275
|
- lib/templates/game/models/hero.rb
|
@@ -264,10 +286,15 @@ files:
|
|
264
286
|
- lib/templates/model.rb.tt
|
265
287
|
- lib/templates/scene.rb.tt
|
266
288
|
- lib/templates/view.yaml.tt
|
289
|
+
- lib/tmx_ext/object.rb
|
290
|
+
- lib/tmx_ext/object_shape.rb
|
291
|
+
- lib/tmx_ext/tile_set.rb
|
267
292
|
- metro.gemspec
|
293
|
+
- metro.png
|
268
294
|
- spec/core_ext/numeric_spec.rb
|
269
295
|
- spec/core_ext/string_spec.rb
|
270
296
|
- spec/gosu_ext/color_spec.rb
|
297
|
+
- spec/metro/image_spec.rb
|
271
298
|
- spec/metro/models/key_value_coding_spec.rb
|
272
299
|
- spec/metro/models/properties/array_property_spec.rb
|
273
300
|
- spec/metro/models/properties/color_property_spec.rb
|
@@ -285,41 +312,40 @@ files:
|
|
285
312
|
- spec/metro/scene_views/yaml_view_spec.rb
|
286
313
|
- spec/metro/scenes_spec.rb
|
287
314
|
- spec/metro/units/point_spec.rb
|
315
|
+
- spec/metro/units/rectangle_bounds_spec.rb
|
288
316
|
- spec/metro/views/view_spec.rb
|
289
317
|
- spec/setup_handlers/exit_if_dry_run_spec.rb
|
290
318
|
- spec/setup_handlers/reload_game_on_game_file_changes_spec.rb
|
291
319
|
- spec/spec_helper.rb
|
320
|
+
- spec/tmx_ext/object_spec.rb
|
321
|
+
- spec/tmx_ext/tile_set_spec.rb
|
292
322
|
homepage: https://github.com/burtlo/metro
|
293
323
|
licenses:
|
294
324
|
- MIT
|
325
|
+
metadata: {}
|
295
326
|
post_install_message: ! " ______ ___ _____\n ___ |/ /_____ __ /_______________\n
|
296
327
|
\ __ /|_/ / _ _ \\_ __/__ ___/_ __ \\\n _ / / / / __// /_ _ / /
|
297
328
|
/_/ /\n /_/ /_/ \\___/ \\__/ /_/ \\____/\n\n Thank you for installing
|
298
|
-
metro 0.3.
|
299
|
-
\ Changes:\n \n *
|
300
|
-
classes\n to make it easier to take care of all the basic model attributes.\n
|
301
|
-
\ * Event Management changed in the background. The API remains the\n same.\n
|
302
|
-
\ \n\n ---------------------------------------------------------------------\n"
|
329
|
+
metro 0.3.5 / 2014-08-11.\n ---------------------------------------------------------------------\n
|
330
|
+
\ Changes:\n \n * FIX active_support is now activesupport\n \n\n ---------------------------------------------------------------------\n"
|
303
331
|
rdoc_options: []
|
304
332
|
require_paths:
|
305
333
|
- lib
|
306
334
|
required_ruby_version: !ruby/object:Gem::Requirement
|
307
|
-
none: false
|
308
335
|
requirements:
|
309
336
|
- - ! '>='
|
310
337
|
- !ruby/object:Gem::Version
|
311
338
|
version: '0'
|
312
339
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
313
|
-
none: false
|
314
340
|
requirements:
|
315
341
|
- - ! '>='
|
316
342
|
- !ruby/object:Gem::Version
|
317
343
|
version: '0'
|
318
344
|
requirements: []
|
319
345
|
rubyforge_project:
|
320
|
-
rubygems_version:
|
346
|
+
rubygems_version: 2.2.2
|
321
347
|
signing_key:
|
322
|
-
specification_version:
|
348
|
+
specification_version: 4
|
323
349
|
summary: Metro is a 2D Gaming framework built around gosu (game development library).
|
324
350
|
Metro makes it easy to create games by enforcing common conceptual structures and
|
325
351
|
conventions.
|
@@ -327,6 +353,7 @@ test_files:
|
|
327
353
|
- spec/core_ext/numeric_spec.rb
|
328
354
|
- spec/core_ext/string_spec.rb
|
329
355
|
- spec/gosu_ext/color_spec.rb
|
356
|
+
- spec/metro/image_spec.rb
|
330
357
|
- spec/metro/models/key_value_coding_spec.rb
|
331
358
|
- spec/metro/models/properties/array_property_spec.rb
|
332
359
|
- spec/metro/models/properties/color_property_spec.rb
|
@@ -344,8 +371,10 @@ test_files:
|
|
344
371
|
- spec/metro/scene_views/yaml_view_spec.rb
|
345
372
|
- spec/metro/scenes_spec.rb
|
346
373
|
- spec/metro/units/point_spec.rb
|
374
|
+
- spec/metro/units/rectangle_bounds_spec.rb
|
347
375
|
- spec/metro/views/view_spec.rb
|
348
376
|
- spec/setup_handlers/exit_if_dry_run_spec.rb
|
349
377
|
- spec/setup_handlers/reload_game_on_game_file_changes_spec.rb
|
350
378
|
- spec/spec_helper.rb
|
351
|
-
|
379
|
+
- spec/tmx_ext/object_spec.rb
|
380
|
+
- spec/tmx_ext/tile_set_spec.rb
|