dxruby_rp5 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/dxruby_rp5.gemspec +1 -1
- data/lib/dxruby_rp5/image.rb +1 -0
- data/lib/dxruby_rp5/render_target.rb +1 -0
- data/lib/dxruby_rp5/runner.rb +7 -0
- data/lib/dxruby_rp5/version.rb +1 -1
- data/spec/lib/dxruby_rp5/image_spec.rb +96 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d389ace1e68ca99ad2743e9ce4f516a4eaccbde
|
4
|
+
data.tar.gz: 1fbd680b020f016b9c8c9c5607a5254c8591621b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1d7a85aa78a4acc95f533f2b9ef5d9039f2efade25d87c4fede7c8adb113bef4d3b9cda47288a1a3a596403c42bfa5019191b6b02e995d89931cd3a5c57924b
|
7
|
+
data.tar.gz: ff8e31a5cfc899517cbb54a32efba7a5362038326a0bfb003a3c45f9caa2327ea9a5858946f07a9f3d8948d9a4fae411f5937f3e5f536c59ae5c27110e9e1e19
|
data/README.md
CHANGED
@@ -22,6 +22,10 @@ Add this line to your application's Gemfile:
|
|
22
22
|
|
23
23
|
gem 'dxruby_rp5'
|
24
24
|
|
25
|
+
If your ruby-processing version is lower than 2.4.0 (ex. 2.3.x):
|
26
|
+
|
27
|
+
gem 'dxruby_rp5', '0.0.2'
|
28
|
+
|
25
29
|
And then execute:
|
26
30
|
|
27
31
|
$ bundle
|
@@ -30,6 +34,10 @@ Or install it yourself as:
|
|
30
34
|
|
31
35
|
$ gem install dxruby_rp5
|
32
36
|
|
37
|
+
If your ruby-processing version is lower than 2.4.0 (ex. 2.3.x):
|
38
|
+
|
39
|
+
$ gem install dxruby_rp5 -v 0.0.2
|
40
|
+
|
33
41
|
## Usage
|
34
42
|
|
35
43
|
```bash
|
data/dxruby_rp5.gemspec
CHANGED
data/lib/dxruby_rp5/image.rb
CHANGED
data/lib/dxruby_rp5/runner.rb
CHANGED
data/lib/dxruby_rp5/version.rb
CHANGED
@@ -191,4 +191,100 @@ describe DXRubyRP5::Image, '画像を表すクラス' do
|
|
191
191
|
end
|
192
192
|
end
|
193
193
|
end
|
194
|
+
|
195
|
+
shared_context '#width #height' do
|
196
|
+
let(:image) { described_class.new(100, 60) }
|
197
|
+
let(:rp5_pimage) {
|
198
|
+
s = double('_surface')
|
199
|
+
allow(s).to receive(:width).and_return(100)
|
200
|
+
allow(s).to receive(:height).and_return(60)
|
201
|
+
image.instance_variable_set(:@_surface, s)
|
202
|
+
s
|
203
|
+
}
|
204
|
+
end
|
205
|
+
|
206
|
+
describe '#width' do
|
207
|
+
|
208
|
+
subject { image.width }
|
209
|
+
|
210
|
+
include_context '#width #height'
|
211
|
+
|
212
|
+
it { should eq(100) }
|
213
|
+
end
|
214
|
+
|
215
|
+
describe '#height' do
|
216
|
+
subject { image.height }
|
217
|
+
|
218
|
+
include_context '#width #height'
|
219
|
+
|
220
|
+
it { should eq(60) }
|
221
|
+
end
|
222
|
+
|
223
|
+
describe '#[]' do
|
224
|
+
let(:image) { described_class.load(fixture_path('image.png')) }
|
225
|
+
|
226
|
+
subject { image[10, 10] }
|
227
|
+
|
228
|
+
context 'formatがRGBの画像を指定した場合' do
|
229
|
+
let(:image) {
|
230
|
+
image = described_class.load(fixture_path('image.png'))
|
231
|
+
image._surface.format = Processing::App::RGB
|
232
|
+
image
|
233
|
+
}
|
234
|
+
|
235
|
+
it { should eq([255, 0, 0]) }
|
236
|
+
end
|
237
|
+
|
238
|
+
context 'formatがARGBの画像を指定した場合' do
|
239
|
+
it { should eq([255, 255, 0, 0]) }
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
describe '#[]=' do
|
244
|
+
let(:image) { described_class.load(fixture_path('image.png')) }
|
245
|
+
let(:color) { [255, 255, 255, 0] }
|
246
|
+
|
247
|
+
before { image[10, 10] = color }
|
248
|
+
|
249
|
+
subject { image[10, 10] }
|
250
|
+
|
251
|
+
shared_context '#[]=' do
|
252
|
+
context 'RGBの色を指定した場合' do
|
253
|
+
let(:color) { [255, 255, 0] }
|
254
|
+
|
255
|
+
it { should eq(expect_color) }
|
256
|
+
|
257
|
+
it '引数の色を直接操作しない' do
|
258
|
+
color.should eq([255, 255, 0])
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
context 'ARGBの色を指定した場合' do
|
263
|
+
let(:color) { [255, 255, 255, 0] }
|
264
|
+
|
265
|
+
it { should eq(expect_color) }
|
266
|
+
|
267
|
+
it '引数の色を直接操作しない' do
|
268
|
+
color.should eq([255, 255, 255, 0])
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
context 'formatがRGBの画像に' do
|
274
|
+
let(:image) {
|
275
|
+
image = described_class.load(fixture_path('image.png'))
|
276
|
+
image._surface.format = Processing::App::RGB
|
277
|
+
image
|
278
|
+
}
|
279
|
+
let(:expect_color) { [255, 255, 0] }
|
280
|
+
|
281
|
+
include_context '#[]='
|
282
|
+
end
|
283
|
+
|
284
|
+
context 'formatがARGBの画像を指定した場合' do
|
285
|
+
let(:expect_color) { [255, 255, 255, 0] }
|
286
|
+
|
287
|
+
include_context '#[]='
|
288
|
+
end
|
289
|
+
end
|
194
290
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dxruby_rp5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Morohoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.4'
|
55
55
|
description: '`dxruby-rp5` is a ruby library for 2D graphics and game. `dxruby-rp5`
|
56
56
|
uses `ruby-processing` and has API same as DXRuby.'
|
57
57
|
email:
|