jruby_art 1.2.4 → 1.2.5

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: 12cfcbc0d3a42e7239ce463edf77df08f0d09357
4
- data.tar.gz: 011a9c8ec37f597b2cf965587f697d3c7e174183
3
+ metadata.gz: d1b91cea8de9bdd46bff4b9d7f87eb566d37db6a
4
+ data.tar.gz: 5acbc932e3a7b9ba2fc4dbbe11a83145eec1aa18
5
5
  SHA512:
6
- metadata.gz: f152caef048293ce58cf678fad2247cb68aff0a81d85a623ee69557ac096ff88e82012ed31107b9e484a0aadc770f35995a8a501b0a79cb065fecfd5bfc41d7d
7
- data.tar.gz: b05d4c483c0a5e5a8ef84742f3f0687226be1369add771be465ca3dcca2e0f851855034fac641a477ad55c80a5f9ab3985ec0df2626562889ef0e3a65057498b
6
+ metadata.gz: 2dee4798bfb73b5c99c2884747bb855fc38cbd22a67b5fe9200d695229e85509841b2d6f06c276e434c9e1ed50d2171711a42c5a04258c674e396afd8df65ae6
7
+ data.tar.gz: 60ca9549ffa124cdf2d695f7539e7aaf2709986f715f303c2ddae395fc5a45b4728af4e3c10c5f49f891058d77c6aee56f20f1a05108fec0c0e44e8dd1db5c5a
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # A wrapper for version
3
3
  module JRubyArt
4
- VERSION = '1.2.4'.freeze
4
+ VERSION = '1.2.5'.freeze
5
5
  end
data/lib/rpextras.jar CHANGED
Binary file
@@ -1,11 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  # Boids -- after Tom de Smedt.
2
3
  # See his Python version: http://nodebox.net/code/index.php/Boids
3
4
  # This is an example of how a pure-Ruby library can work. Original for
4
5
  # ruby-processing Jeremy Ashkenas. Reworked, re-factored for JRubyArt 0.9+
5
6
  # by Martin Prout, features forwardable, keyword args, Vec3D and Vec2D.
6
7
  class Boid
7
- attr_accessor :boids, :pos, :vel, :is_perching, :perch_time
8
-
8
+ attr_reader :boids
9
+ attr_accessor :vel, :pos, :is_perching, :perch_time
9
10
  def initialize(boids, pos)
10
11
  @boids, @flock = boids, boids
11
12
  @pos = pos
@@ -83,7 +84,7 @@ class Boids
83
84
 
84
85
  def self.flock(n:, x:, y:, w:, h:)
85
86
  flock = Boids.new.setup(n, x, y, w, h)
86
- flock.goal(target: Vec3D.new(w / 2, h / 2, 0))
87
+ flock.reset_goal(Vec3D.new(w / 2, h / 2, 0))
87
88
  end
88
89
 
89
90
  def setup(n, x, y, w, h)
@@ -125,7 +126,14 @@ class Boids
125
126
  @perch = 0.0
126
127
  end
127
128
 
128
- def goal(target:, flee: false)
129
+ def reset_goal(target)
130
+ @has_goal = true
131
+ @flee = false
132
+ @goal = target
133
+ self
134
+ end
135
+
136
+ def goal(target:, flee:)
129
137
  @has_goal = true
130
138
  @flee = flee
131
139
  @goal = target
@@ -141,14 +149,14 @@ class Boids
141
149
  dx, dy = @w * 0.1, @h * 0.1
142
150
  each do |b|
143
151
  b.vel.x += rand(dx) if b.pos.x < @x - dx
144
- b.vel.x += rand(dy) if b.pos.y < @y - dy
152
+ b.vel.y += rand(dy) if b.pos.y < @y - dy
145
153
  b.vel.x -= rand(dx) if b.pos.x > @x + @w + dx
146
154
  b.vel.y -= rand(dy) if b.pos.y > @y + @h + dy
147
155
  b.vel.z += 10.0 if b.pos.z < 0.0
148
156
  b.vel.z -= 10.0 if b.pos.z > 100.0
149
157
  next unless b.pos.y > perch_y && rand < perch
150
158
  b.pos.y = perch_y
151
- b.vel.y = -(b.vel.y.abs) * 0.2
159
+ b.vel.y = b.vel.y.abs * -0.2
152
160
  b.is_perching = true
153
161
  b.perch_time = perch_tm.respond_to?(:call) ? perch_tm.call : perch_tm
154
162
  end
@@ -166,7 +174,7 @@ class Boids
166
174
  m2 = 1.0 # separation
167
175
  m3 = 1.0 # alignment
168
176
  m4 = 1.0 # goal
169
- @scattered = true if !(@scattered) && rand < @scatter
177
+ @scattered = true if !@scattered && rand < @scatter
170
178
  if @scattered
171
179
  m1 = -m1
172
180
  m3 *= 0.25
@@ -1,12 +1,14 @@
1
1
  # require 'rpextras'
2
- #@todo fix how we call LIbrary Proxy
2
+ #@todo fix how we call Library Proxy
3
3
  java_import Java::MonkstoneCore::LibraryProxy
4
4
 
5
5
 
6
6
  # classes that inherit from Library are expected to implement
7
- # the abstract methods of processing.core.LibraryProxy
7
+ # the abstract methods of monkstone.core.LibraryProxy
8
8
  # def pre...
9
9
  # def draw...
10
10
  # def post...
11
+ # def keyPressed...
12
+ # def mousePressed...
11
13
  # NOOP is fine...
12
- # `app` can be called to get PApplet instance
14
+ # `app` can be called to get PApplet instance
data/vendors/Rakefile CHANGED
@@ -9,7 +9,7 @@ WARNING = <<-EOS
9
9
  EOS
10
10
 
11
11
  JRUBYC_VERSION = '9.1.5.0'
12
- EXAMPLES = '1.5'
12
+ EXAMPLES = '1.6'
13
13
  HOME_DIR = ENV['HOME']
14
14
  MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby_art
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-09-07 00:00:00.000000000 Z
13
+ date: 2016-10-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -40,12 +40,11 @@ dependencies:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '5.8'
43
- description: " JRubyArt is a ruby wrapper for the processing art framework.\n Use
44
- both processing libraries and ruby gems in your sketches. Features \n create/run/watch/live
45
- modes. The \"--watch\" mode, provides a nice REPL-ish \n way to work on your processing
46
- sketches. Includes:-\n A \"Control Panel\" library, so that you can easily create
47
- sliders, buttons,\n checkboxes and drop-down menus, and hook them into your sketch's
48
- instance\n variables and hundreds of worked examples to get you started...\n"
43
+ description: |2
44
+ JRubyArt is a ruby wrapper for the processing art framework.
45
+ Use both processing libraries and ruby gems in your sketches. Features
46
+ create/run/watch/live modes. The "--watch" mode, provides a nice REPL-ish
47
+ way to work on your processing sketches. NB: See homepage for documentation.
49
48
  email: mamba2928@yahoo.co.uk
50
49
  executables:
51
50
  - k9