ruby2d 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b09f451947f3fc56b0cb4dd9db0456742dbee214
4
- data.tar.gz: 9eb11dbc8fe45f524bf839805b605b8fc2cf500a
3
+ metadata.gz: 5a8a4ec99e4973a77f73aa07a46accf88b4d6ab4
4
+ data.tar.gz: 73fbe78e3065d33795a1da5bb187b118075f9f58
5
5
  SHA512:
6
- metadata.gz: b861dc80da37d1462cb1441161fed07c97cc83d4b9f5b0b028e0c8192d3d23bfd330ace7b59a7da0d61afdd56c6e6dffffdf26a670bc53279a39fcba88d2f1c9
7
- data.tar.gz: 2b45106ba0dce7be767660096b777388aa75171551c34f433cef167d9ccd700e579fb70d8b551cd58fcb3057f077c834f865bf4d356f4b56b1622bd3ea5ec2e9
6
+ metadata.gz: 18d3baa25a0dc7819f7b22ad49add7f1562356cc978aa52886020c68a54586063ab7ef4cecad07482c4933c8dd82955a7cfb2143b2c00cf1fc737c191ed68f00
7
+ data.tar.gz: fd5aed42f38a5431f8f7821c062cf5b52ee4ecf31c36990dd4e5b477bb064e00b719478356abdd93cadbff0e4ad64b33ae8ab85c273b625fcb5ef663bbac220c
data/ext/ruby2d/ruby2d.c CHANGED
@@ -174,8 +174,14 @@ static R_VAL ruby2d_image_init(R_VAL self, R_VAL path) {
174
174
  sprintf(S2D_msg, "Init image: %s", RSTRING_PTR(path));
175
175
  S2D_Log(S2D_msg, S2D_INFO);
176
176
  S2D_Image *img = S2D_CreateImage(RSTRING_PTR(path));
177
- r_iv_set(self, "@width", INT2NUM(img->width));
178
- r_iv_set(self, "@height", INT2NUM(img->height));
177
+
178
+ // Get width and height from Ruby class. If set, use it, else choose the
179
+ // native dimensions of the image.
180
+ R_VAL w = r_iv_get(self, "@width");
181
+ R_VAL h = r_iv_get(self, "@height");
182
+ r_iv_set(self, "@width" , r_test(w) ? w : INT2NUM(img->width));
183
+ r_iv_set(self, "@height", r_test(h) ? h : INT2NUM(img->height));
184
+
179
185
  r_iv_set(self, "@data", r_data_wrap_struct(image, img));
180
186
  return R_NIL;
181
187
  }
data/lib/ruby2d/image.rb CHANGED
@@ -18,7 +18,9 @@ module Ruby2D
18
18
 
19
19
  @x = opts[:x] || 0
20
20
  @y = opts[:y] || 0
21
- @z = opts[:x] || 0
21
+ @z = opts[:z] || 0
22
+ @width = opts[:width] || nil
23
+ @height = opts[:height] || nil
22
24
 
23
25
  @type_id = 4
24
26
 
@@ -1,5 +1,5 @@
1
1
  # version.rb
2
2
 
3
3
  module Ruby2D
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2d
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Black
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal