Skip to content

Commit d901395

Browse files
committed
Fix aset Vec2D
1 parent 9e3866c commit d901395

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

jruby_art.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Gem::Specification.new do |spec|
1212
spec.description = <<-EOS
1313
JRubyArt is a ruby wrapper for the processing art framework, with enhanced
1414
functionality. Use both processing libraries and ruby gems in your sketches.
15-
Features create/run/watch/live modes. The current release features several
16-
PixelFlow glsl library examples, including a few shadertoy demos as sketches.
15+
Features create/run/watch/live modes. The current release features may be the
16+
last before we start supporting ruby-2.4 in sketches.
1717
EOS
1818
spec.summary = %q{Code as Art, Art as Code. Processing and Ruby are meant for each other.}
1919
spec.homepage = "https://ruby-processing.github.io/JRubyArt/"
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
2727
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
2828
spec.require_paths = ['lib']
2929
spec.required_ruby_version = '>= 2.3'
30-
spec.add_development_dependency 'rake', '~> 12'
30+
spec.add_development_dependency 'rake', '~> 12.3'
3131
spec.add_development_dependency 'minitest', '~> 5.10'
3232
spec.requirements << 'A decent graphics card'
33-
spec.requirements << 'java runtime >= 1.8.0_131+'
33+
spec.requirements << 'java runtime >= 1.8.0_151+'
3434
spec.requirements << 'processing = 3.3.6'
3535
end

src/monkstone/vecmath/vec2/Vec2.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
package monkstone.vecmath.vec2;
22

3-
/*
3+
/*
44
* Copyright (c) 2015-17 Martin Prout
5-
*
5+
*
66
* This library is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU Lesser General Public
88
* License as published by the Free Software Foundation; either
99
* version 2.1 of the License, or (at your option) any later version.
10-
*
10+
*
1111
* http://creativecommons.org/licenses/LGPL/2.1/
12-
*
12+
*
1313
* This library is distributed in the hope that it will be useful,
1414
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1515
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1616
* Lesser General Public License for more details.
17-
*
17+
*
1818
* You should have received a copy of the GNU Lesser General Public
1919
* License along with this library; if not, write to the Free Software
2020
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -153,9 +153,11 @@ public IRubyObject aset(ThreadContext context, IRubyObject key, IRubyObject valu
153153
Ruby runtime = context.runtime;
154154
if (key instanceof RubySymbol) {
155155
if (key == RubySymbol.newSymbol(runtime, "x")) {
156-
return runtime.newFloat(jx);
156+
jx = (value instanceof RubyFloat)
157+
? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
157158
} else if (key == RubySymbol.newSymbol(runtime, "y")) {
158-
return runtime.newFloat(jy);
159+
jy = (value instanceof RubyFloat)
160+
? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
159161
}
160162
} else {
161163
throw runtime.newIndexError("invalid key");

0 commit comments

Comments
 (0)