gamebox 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/gamebox.gemspec +3 -3
- data/lib/gamebox/core/tween_manager.rb +23 -0
- data/lib/gamebox/core/tween_wrapper.rb +28 -0
- data/lib/gamebox/lib/rect.rb +3 -4
- data/lib/gamebox/tasks/gamebox_tasks.rake +6 -1
- data/lib/gamebox/version.rb +1 -1
- data/spec/lib/rect_spec.rb +28 -0
- metadata +54 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 487cfbc0092a899c74c2f07629e61103cf260b04
|
4
|
+
data.tar.gz: af6c816285ad7ec45b7c2d55210a440678369da3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5697dae2d2c4445f3ad9a3f80d934d7441f7c366e67385b7e217b834c06032e14a591f8b8b3ad3ae2fe69a479b9b1ab6c843acf0e0b5dfa5b1ce51ebb6949ea
|
7
|
+
data.tar.gz: a919445492b6544466be9732f41db72f0700dfe5034aa8ae4f6350b0618f71f07ef9cbcb0e7d0754e899317b3aa9308aea47e04a508b3fd684cbd8a4f1029e85
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Gamebox
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/gamebox.svg)](http://badge.fury.io/rb/gamebox)
|
3
4
|
[![Gamebox Build Status](https://secure.travis-ci.org/shawn42/gamebox.png)](http://travis-ci.org/shawn42/gamebox)
|
4
5
|
[![Gamebox Deps Status](https://gemnasium.com/shawn42/gamebox.png)](https://gemnasium.com/shawn42/gamebox)
|
5
6
|
[![Code Climate](https://codeclimate.com/github/shawn42/gamebox.png)](https://codeclimate.com/github/shawn42/gamebox)
|
data/gamebox.gemspec
CHANGED
@@ -30,9 +30,9 @@ Gem::Specification.new do |s|
|
|
30
30
|
|
31
31
|
s.add_development_dependency "pry", '~>0.9.7'
|
32
32
|
s.add_development_dependency "pry-remote"
|
33
|
-
s.add_development_dependency "rspec-core"
|
34
|
-
s.add_development_dependency "rspec-mocks"
|
35
|
-
s.add_development_dependency "rspec-expectations"
|
33
|
+
s.add_development_dependency "rspec-core", '~>2.13.0'
|
34
|
+
s.add_development_dependency "rspec-mocks", "~>2.13.0"
|
35
|
+
s.add_development_dependency "rspec-expectations", '~>2.13.0'
|
36
36
|
s.add_development_dependency "mocha"
|
37
37
|
s.add_development_dependency "rspec"
|
38
38
|
s.add_development_dependency "rake"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class TweenManager
|
2
|
+
construct_with :director
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@tweens = []
|
6
|
+
director.when :update, &method(:update)
|
7
|
+
end
|
8
|
+
|
9
|
+
def tween_properties(actor, properties, time, tween_style=Tween::Linear)
|
10
|
+
tween = TweenWrapper.new(actor, properties, time, tween_style)
|
11
|
+
@tweens << tween
|
12
|
+
# return it so we can cancel it
|
13
|
+
tween
|
14
|
+
end
|
15
|
+
|
16
|
+
def update(time, time_in_secs)
|
17
|
+
@tweens.each do |tween|
|
18
|
+
tween.update time unless tween.done?
|
19
|
+
end
|
20
|
+
@tweens.reject! &:done?
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class TweenWrapper
|
2
|
+
|
3
|
+
def initialize(actor, property_targets, time, style)
|
4
|
+
@actor = actor
|
5
|
+
@actor.when :remove_me, &method(:cancel!)
|
6
|
+
@props = property_targets.keys
|
7
|
+
initial_values = @props.map{|pr|actor.send(pr)}
|
8
|
+
target_values = @props.map{|pr|property_targets[pr]}
|
9
|
+
@tween = Tween.new(initial_values, target_values, style, time)
|
10
|
+
end
|
11
|
+
|
12
|
+
def update(time)
|
13
|
+
@tween.update time
|
14
|
+
@props.each.with_index do |prop, i|
|
15
|
+
# maybe use update_attributes instead?
|
16
|
+
@actor.send("#{prop}=", @tween[i])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def cancel!
|
21
|
+
@cancel = true
|
22
|
+
end
|
23
|
+
|
24
|
+
def done?
|
25
|
+
@tween.done || @cancel
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
data/lib/gamebox/lib/rect.rb
CHANGED
@@ -498,10 +498,9 @@ class Rect < Array
|
|
498
498
|
|
499
499
|
# True if the caller and the given Rect overlap (or touch) at all.
|
500
500
|
def collide_rect?(rect)
|
501
|
-
|
502
|
-
rect
|
503
|
-
|
504
|
-
((nself.t >= rect.t && nself.t <= rect.b) or (rect.t >= nself.t && rect.t <= nself.b))
|
501
|
+
rect = Rect.new_from_object(rect)
|
502
|
+
((l >= rect.l && l <= rect.r) or (rect.l >= l && rect.l <= r)) &&
|
503
|
+
((t >= rect.t && t <= rect.b) or (rect.t >= t && rect.t <= b))
|
505
504
|
end
|
506
505
|
|
507
506
|
# True if the given Rect is totally within the caller. Borders may
|
@@ -22,7 +22,12 @@ end
|
|
22
22
|
desc "Bundle in all required gems"
|
23
23
|
task :bundle do |t|
|
24
24
|
sh "bundle package"
|
25
|
-
|
25
|
+
|
26
|
+
if Bundler::VERSION =~ /^0/
|
27
|
+
sh "bundle install vendor/bundle --disable-shared-gems"
|
28
|
+
else
|
29
|
+
sh "bundle install --deployment"
|
30
|
+
end
|
26
31
|
end
|
27
32
|
|
28
33
|
desc "Run specs"
|
data/lib/gamebox/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Rect do
|
4
|
+
describe "#collide_rect?" do
|
5
|
+
subject { Rect.new 0,0,3,4 }
|
6
|
+
|
7
|
+
it 'finds collisions' do
|
8
|
+
collides_with(0,0,3,4)
|
9
|
+
collides_with(1,0,3,4)
|
10
|
+
collides_with(0,1,3,4)
|
11
|
+
collides_with(1,1,2,3)
|
12
|
+
|
13
|
+
does_not_collide_with(4,5,2,3)
|
14
|
+
does_not_collide_with(-2,-2,1,1)
|
15
|
+
does_not_collide_with(-2,2,1,1)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def collides_with(x,y,w,h)
|
20
|
+
subject.collide_rect?(Rect.new(x,y,w,h)).should be_true
|
21
|
+
end
|
22
|
+
|
23
|
+
def does_not_collide_with(x,y,w,h)
|
24
|
+
subject.collide_rect?(Rect.new(x,y,w,h)).should be_false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shawn Anderson
|
@@ -10,286 +10,286 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gosu
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: publisher
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: conject
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 0.0.8
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 0.0.8
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: tween
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: i18n
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: thor
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
type: :runtime
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: require_all
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
type: :runtime
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: kvo
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: 0.1.0
|
120
120
|
type: :runtime
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- -
|
124
|
+
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: 0.1.0
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: listen
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- -
|
131
|
+
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: 2.4.0
|
134
134
|
type: :runtime
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- -
|
138
|
+
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: 2.4.0
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: pry
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- - ~>
|
145
|
+
- - "~>"
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: 0.9.7
|
148
148
|
type: :development
|
149
149
|
prerelease: false
|
150
150
|
version_requirements: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- - ~>
|
152
|
+
- - "~>"
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: 0.9.7
|
155
155
|
- !ruby/object:Gem::Dependency
|
156
156
|
name: pry-remote
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- -
|
159
|
+
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
161
|
version: '0'
|
162
162
|
type: :development
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
|
-
- -
|
166
|
+
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: rspec-core
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
|
-
- -
|
173
|
+
- - "~>"
|
174
174
|
- !ruby/object:Gem::Version
|
175
|
-
version:
|
175
|
+
version: 2.13.0
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
178
|
version_requirements: !ruby/object:Gem::Requirement
|
179
179
|
requirements:
|
180
|
-
- -
|
180
|
+
- - "~>"
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version:
|
182
|
+
version: 2.13.0
|
183
183
|
- !ruby/object:Gem::Dependency
|
184
184
|
name: rspec-mocks
|
185
185
|
requirement: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- -
|
187
|
+
- - "~>"
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
189
|
+
version: 2.13.0
|
190
190
|
type: :development
|
191
191
|
prerelease: false
|
192
192
|
version_requirements: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
|
-
- -
|
194
|
+
- - "~>"
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
-
version:
|
196
|
+
version: 2.13.0
|
197
197
|
- !ruby/object:Gem::Dependency
|
198
198
|
name: rspec-expectations
|
199
199
|
requirement: !ruby/object:Gem::Requirement
|
200
200
|
requirements:
|
201
|
-
- -
|
201
|
+
- - "~>"
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version:
|
203
|
+
version: 2.13.0
|
204
204
|
type: :development
|
205
205
|
prerelease: false
|
206
206
|
version_requirements: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
|
-
- -
|
208
|
+
- - "~>"
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
210
|
+
version: 2.13.0
|
211
211
|
- !ruby/object:Gem::Dependency
|
212
212
|
name: mocha
|
213
213
|
requirement: !ruby/object:Gem::Requirement
|
214
214
|
requirements:
|
215
|
-
- -
|
215
|
+
- - ">="
|
216
216
|
- !ruby/object:Gem::Version
|
217
217
|
version: '0'
|
218
218
|
type: :development
|
219
219
|
prerelease: false
|
220
220
|
version_requirements: !ruby/object:Gem::Requirement
|
221
221
|
requirements:
|
222
|
-
- -
|
222
|
+
- - ">="
|
223
223
|
- !ruby/object:Gem::Version
|
224
224
|
version: '0'
|
225
225
|
- !ruby/object:Gem::Dependency
|
226
226
|
name: rspec
|
227
227
|
requirement: !ruby/object:Gem::Requirement
|
228
228
|
requirements:
|
229
|
-
- -
|
229
|
+
- - ">="
|
230
230
|
- !ruby/object:Gem::Version
|
231
231
|
version: '0'
|
232
232
|
type: :development
|
233
233
|
prerelease: false
|
234
234
|
version_requirements: !ruby/object:Gem::Requirement
|
235
235
|
requirements:
|
236
|
-
- -
|
236
|
+
- - ">="
|
237
237
|
- !ruby/object:Gem::Version
|
238
238
|
version: '0'
|
239
239
|
- !ruby/object:Gem::Dependency
|
240
240
|
name: rake
|
241
241
|
requirement: !ruby/object:Gem::Requirement
|
242
242
|
requirements:
|
243
|
-
- -
|
243
|
+
- - ">="
|
244
244
|
- !ruby/object:Gem::Version
|
245
245
|
version: '0'
|
246
246
|
type: :development
|
247
247
|
prerelease: false
|
248
248
|
version_requirements: !ruby/object:Gem::Requirement
|
249
249
|
requirements:
|
250
|
-
- -
|
250
|
+
- - ">="
|
251
251
|
- !ruby/object:Gem::Version
|
252
252
|
version: '0'
|
253
253
|
- !ruby/object:Gem::Dependency
|
254
254
|
name: polaris
|
255
255
|
requirement: !ruby/object:Gem::Requirement
|
256
256
|
requirements:
|
257
|
-
- -
|
257
|
+
- - ">="
|
258
258
|
- !ruby/object:Gem::Version
|
259
259
|
version: '0'
|
260
260
|
type: :development
|
261
261
|
prerelease: false
|
262
262
|
version_requirements: !ruby/object:Gem::Requirement
|
263
263
|
requirements:
|
264
|
-
- -
|
264
|
+
- - ">="
|
265
265
|
- !ruby/object:Gem::Version
|
266
266
|
version: '0'
|
267
267
|
- !ruby/object:Gem::Dependency
|
268
268
|
name: simplecov
|
269
269
|
requirement: !ruby/object:Gem::Requirement
|
270
270
|
requirements:
|
271
|
-
- -
|
271
|
+
- - ">="
|
272
272
|
- !ruby/object:Gem::Version
|
273
273
|
version: '0'
|
274
274
|
type: :development
|
275
275
|
prerelease: false
|
276
276
|
version_requirements: !ruby/object:Gem::Requirement
|
277
277
|
requirements:
|
278
|
-
- -
|
278
|
+
- - ">="
|
279
279
|
- !ruby/object:Gem::Version
|
280
280
|
version: '0'
|
281
281
|
- !ruby/object:Gem::Dependency
|
282
282
|
name: chipmunk
|
283
283
|
requirement: !ruby/object:Gem::Requirement
|
284
284
|
requirements:
|
285
|
-
- -
|
285
|
+
- - ">="
|
286
286
|
- !ruby/object:Gem::Version
|
287
287
|
version: '0'
|
288
288
|
type: :development
|
289
289
|
prerelease: false
|
290
290
|
version_requirements: !ruby/object:Gem::Requirement
|
291
291
|
requirements:
|
292
|
-
- -
|
292
|
+
- - ">="
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: '0'
|
295
295
|
description: Framework for building and distributing games using Gosu
|
@@ -377,6 +377,8 @@ files:
|
|
377
377
|
- lib/gamebox/core/stage_manager.rb
|
378
378
|
- lib/gamebox/core/svg_document.rb
|
379
379
|
- lib/gamebox/core/timer_manager.rb
|
380
|
+
- lib/gamebox/core/tween_manager.rb
|
381
|
+
- lib/gamebox/core/tween_wrapper.rb
|
380
382
|
- lib/gamebox/core/viewport.rb
|
381
383
|
- lib/gamebox/core/wrapped_screen.rb
|
382
384
|
- lib/gamebox/data/fonts/Asimov.ttf
|
@@ -466,6 +468,7 @@ files:
|
|
466
468
|
- spec/fixtures/snelpling/jump/3.png
|
467
469
|
- spec/helper.rb
|
468
470
|
- spec/lib/class_finder_spec.rb
|
471
|
+
- spec/lib/rect_spec.rb
|
469
472
|
- spec/views/graphical_actor_view_spec.rb
|
470
473
|
- templates/actor_template.erb
|
471
474
|
- templates/app/.gitignore
|
@@ -496,12 +499,12 @@ require_paths:
|
|
496
499
|
- lib
|
497
500
|
required_ruby_version: !ruby/object:Gem::Requirement
|
498
501
|
requirements:
|
499
|
-
- -
|
502
|
+
- - ">="
|
500
503
|
- !ruby/object:Gem::Version
|
501
504
|
version: '0'
|
502
505
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
503
506
|
requirements:
|
504
|
-
- -
|
507
|
+
- - ">="
|
505
508
|
- !ruby/object:Gem::Version
|
506
509
|
version: '0'
|
507
510
|
requirements: []
|
@@ -558,4 +561,5 @@ test_files:
|
|
558
561
|
- spec/fixtures/snelpling/jump/3.png
|
559
562
|
- spec/helper.rb
|
560
563
|
- spec/lib/class_finder_spec.rb
|
564
|
+
- spec/lib/rect_spec.rb
|
561
565
|
- spec/views/graphical_actor_view_spec.rb
|