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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb5c7db324f26776e5b8cefe72972078c7f66c33
4
- data.tar.gz: a70af60322bcaa322e84a1156e544f451fab490a
3
+ metadata.gz: 6d389ace1e68ca99ad2743e9ce4f516a4eaccbde
4
+ data.tar.gz: 1fbd680b020f016b9c8c9c5607a5254c8591621b
5
5
  SHA512:
6
- metadata.gz: 92f31211a527be3bb29a2352ae3b25e22f8c390c37c118612a37d13b1f7334a4399c6cc7a3471cf9bf9ca2c61929d99ba646790b45cb54cf44fd5be07b7cd739
7
- data.tar.gz: 0f56374e146da3307c8c5b544981de545d987f67f0e37fcfb680429c1feed5c405797a51c249225bbf6d26b06e4cf2861265c5dff306bf0bc3842d4904e4e89a
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
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
23
 
24
- spec.add_runtime_dependency "ruby-processing", ">= 2.0"
24
+ spec.add_runtime_dependency "ruby-processing", ">= 2.4"
25
25
  end
@@ -122,6 +122,7 @@ module DXRubyRP5
122
122
 
123
123
  def to_rp5_color(_color)
124
124
  if _color.size > 3
125
+ _color = _color.dup
125
126
  _color.push(_color.shift)
126
127
  end
127
128
  return _color
@@ -101,6 +101,7 @@ module DXRubyRP5
101
101
 
102
102
  def to_rp5_color(color)
103
103
  if color.size > 3
104
+ color = color.dup
104
105
  color.push(color.shift)
105
106
  end
106
107
  return color
@@ -17,6 +17,13 @@ module Processing
17
17
 
18
18
  EOS
19
19
 
20
+ def show_version
21
+ puts <<-EOS
22
+ Ruby-Processing version #{RubyProcessing::VERSION}
23
+ DXRuby_RP5 version #{DXRubyRP5::VERSION}
24
+ EOS
25
+ end
26
+
20
27
  def show_help
21
28
  puts DXRP5_HELP_MESSAGE
22
29
  end
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module DXRubyRP5
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
@@ -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.2
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-04 00:00:00.000000000 Z
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.0'
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.0'
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: