jruby_art 2.2.2 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/bin/k9 +4 -3
  3. data/lib/gluegen-rt-natives-linux-amd64.jar +0 -0
  4. data/lib/gluegen-rt-natives-macosx-universal.jar +0 -0
  5. data/lib/gluegen-rt-natives-windows-amd64.jar +0 -0
  6. data/lib/gluegen-rt.jar +0 -0
  7. data/lib/jogl-all-natives-linux-amd64.jar +0 -0
  8. data/lib/jogl-all-natives-macosx-universal.jar +0 -0
  9. data/lib/jogl-all-natives-windows-amd64.jar +0 -0
  10. data/lib/jogl-all.jar +0 -0
  11. data/lib/jruby_art-2.4.3.jar +0 -0
  12. data/lib/jruby_art/app.rb +8 -7
  13. data/lib/jruby_art/config.rb +2 -0
  14. data/lib/jruby_art/creators/sketch_writer.rb +31 -13
  15. data/lib/jruby_art/default_config.rb +2 -0
  16. data/lib/jruby_art/helper_methods.rb +22 -22
  17. data/lib/jruby_art/helpers/aabb.rb +3 -0
  18. data/lib/jruby_art/helpers/numeric.rb +1 -0
  19. data/lib/jruby_art/installer.rb +10 -7
  20. data/lib/jruby_art/java_opts.rb +2 -0
  21. data/lib/jruby_art/jruby_complete.rb +2 -0
  22. data/lib/jruby_art/launcher.rb +8 -3
  23. data/lib/jruby_art/library.rb +67 -67
  24. data/lib/jruby_art/library_loader.rb +4 -1
  25. data/lib/jruby_art/native_folder.rb +16 -14
  26. data/lib/jruby_art/native_loader.rb +3 -0
  27. data/lib/jruby_art/processing_ide.rb +5 -1
  28. data/lib/jruby_art/runner.rb +12 -10
  29. data/lib/jruby_art/runners/base.rb +1 -0
  30. data/lib/jruby_art/runners/live.rb +10 -7
  31. data/lib/jruby_art/runners/run.rb +1 -0
  32. data/lib/jruby_art/runners/watch.rb +6 -4
  33. data/lib/jruby_art/version.rb +2 -1
  34. data/library/boids/boids.rb +19 -10
  35. data/library/chooser/chooser.rb +10 -9
  36. data/library/color_group/color_group.rb +2 -0
  37. data/library/control_panel/control_panel.rb +8 -5
  38. data/library/dxf/dxf.rb +2 -0
  39. data/library/library_proxy/library_proxy.rb +2 -0
  40. data/library/net/net.rb +2 -0
  41. data/library/slider/slider.rb +24 -23
  42. data/library/vector_utils/vector_utils.rb +5 -1
  43. data/library/video_event/video_event.rb +3 -0
  44. data/vendors/Rakefile +23 -17
  45. metadata +13 -13
  46. data/lib/jruby_art-2.2.2.jar +0 -0
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Usage:
3
4
  # load_library :chooser
4
- #
5
+ #
5
6
  # def setup
6
- # java_signature 'void selectInput(String, String)'
7
- # selectInput('Select a file to process:', 'fileSelected')
7
+ # java_signature 'void selectInput(String, String)'
8
+ # selectInput('Select a file to process:', 'fileSelected')
8
9
  # end
9
- #
10
+ #
10
11
  # def fileSelected(selection)
11
- # if selection.nil?
12
- # puts 'Window was closed or the user hit cancel.'
13
- # else
14
- # puts format('User selected %s', selection.get_absolute_path)
15
- # end
12
+ # if selection.nil?
13
+ # puts 'Window was closed or the user hit cancel.'
14
+ # else
15
+ # puts format('User selected %s', selection.get_absolute_path)
16
+ # end
16
17
  # end
17
18
  class Processing::App
18
19
  include Java::MonkstoneFilechooser::Chooser
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  java_import Java::Monkstone::ColorUtil
2
4
 
3
5
  # class wraps a java color array, supports shuffle!, last and ruby_string
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Here's a little library for quickly hooking up controls to sketches.
2
4
  # For messing with the parameters and such.
3
5
  # These controls will set instance variables on the sketches.
@@ -25,7 +27,7 @@ module ControlPanel
25
27
  add_change_listener do
26
28
  update_label(label, name, value)
27
29
  ControlPanel.app_value(name, value)
28
- proc.call(value) if proc
30
+ proc&.call(value)
29
31
  end
30
32
  ControlPanel.app_value(name, val)
31
33
  end
@@ -49,7 +51,7 @@ module ControlPanel
49
51
  control_panel.add_element(self, name)
50
52
  add_action_listener do
51
53
  ControlPanel.app_value(name, value) unless value.nil?
52
- proc.call(value) if proc
54
+ proc&.call(value)
53
55
  end
54
56
  set_selected_index(initial_value ? elements.index(initial_value) : 0)
55
57
  end
@@ -69,7 +71,7 @@ module ControlPanel
69
71
  control_panel.add_element(self, name, false)
70
72
  add_action_listener do
71
73
  ControlPanel.app_value(name, value)
72
- proc.call(value) if proc
74
+ proc&.call(value)
73
75
  end
74
76
  end
75
77
 
@@ -87,7 +89,7 @@ module ControlPanel
87
89
  control_panel.add_element(self, name, false, true)
88
90
  add_action_listener do
89
91
  Processing.app.send(name)
90
- proc.call(value) if proc
92
+ proc&.call(value)
91
93
  end
92
94
  end
93
95
  end
@@ -160,7 +162,7 @@ module ControlPanel
160
162
  def feel(lf = 'metal')
161
163
  lafinfo = javax.swing.UIManager.getInstalledLookAndFeels
162
164
  laf = lafinfo.to_ary.find do |info|
163
- info.name =~ Regexp.new(Regexp.escape(lf), Regexp::IGNORECASE)
165
+ info.name.match?(Regexp.new(Regexp.escape(lf), Regexp::IGNORECASE))
164
166
  end
165
167
  javax.swing.UIManager.setLookAndFeel(laf.class_name)
166
168
  end
@@ -171,6 +173,7 @@ module ControlPanel
171
173
  def control_panel
172
174
  @control_panel ||= ControlPanel::Panel.new
173
175
  return @control_panel unless block_given?
176
+
174
177
  yield(@control_panel)
175
178
  @control_panel.display
176
179
  @control_panel.set_visible true
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @TODO usage
2
4
  class Processing::App
3
5
  java_import Java::ProcessingDxf::RawDXF
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  java_import Java::MonkstoneCore::LibraryProxy
2
4
  java_import Java::ProcessingEvent::KeyEvent
3
5
  java_import Java::ProcessingEvent::MouseEvent
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @TODO usage
2
4
  class Processing::App
3
5
  java_import Java::ProcessingNet::Client
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Here's a little library for quickly hooking up in sketch sliders.
3
- # Copyright (c) 2016-19 Martin Prout.
4
+ # Copyright (c) 2015-20 Martin Prout.
4
5
 
5
6
  java_import 'monkstone.slider.CustomHorizontalSlider'
6
7
  java_import 'monkstone.slider.CustomVerticalSlider'
@@ -8,34 +9,34 @@ java_import 'monkstone.slider.CustomVerticalSlider'
8
9
  module Slider
9
10
  def self.slider(app:, x:, y:, name:, **opts)
10
11
  options = default.merge opts
11
- if options[:vertical]
12
- slider = CustomVerticalSlider.new(
13
- app,
14
- x,
15
- y,
16
- options[:length],
17
- options[:range].first,
18
- options[:range].last,
19
- name
20
- )
21
- else
22
- slider = CustomHorizontalSlider.new(
23
- app,
24
- x,
25
- y,
26
- options[:length],
27
- options[:range].first,
28
- options[:range].last,
29
- name
30
- )
31
- end
12
+ slider = if options[:vertical]
13
+ CustomVerticalSlider.new(
14
+ app,
15
+ x,
16
+ y,
17
+ options[:length],
18
+ options[:range].first,
19
+ options[:range].last,
20
+ name
21
+ )
22
+ else
23
+ CustomHorizontalSlider.new(
24
+ app,
25
+ x,
26
+ y,
27
+ options[:length],
28
+ options[:range].first,
29
+ options[:range].last,
30
+ name
31
+ )
32
+ end
32
33
  unless opts.empty?
33
34
  slider.bar_width(opts.fetch(:bar_width, 10))
34
35
  slider.set_value(opts.fetch(:initial_value, 0))
35
36
  end
36
37
  slider
37
38
  end
38
-
39
+
39
40
  def self.default
40
41
  { length: 100, range: (0..100) }
41
42
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  PHI ||= (1 + Math.sqrt(5)) / 2 # golden ratio
2
4
  GA = PHI * 2 * Math::PI # golden angle
3
5
 
@@ -47,7 +49,8 @@ module VectorUtil
47
49
 
48
50
  def self.cartesian_to_polar(vec:)
49
51
  res = Vec3D.new(vec.mag, 0, 0)
50
- return Vec3D.new unless res.x > 0
52
+ return Vec3D.new unless res.x.positive?
53
+
51
54
  res.y = -Math.atan2(vec.z, vec.x)
52
55
  res.z = Math.asin(vec.y / res.x)
53
56
  res
@@ -64,6 +67,7 @@ module VectorUtil
64
67
 
65
68
  def self.polar_to_cartesian(vec:)
66
69
  return Vec3D.new if vec.mag <= 0
70
+
67
71
  Vec3D.new(Math.asin(vec.y / vec.mag), vec.mag, -Math.atan2(vec.z, vec.x))
68
72
  end
69
73
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # include interfaces
1
4
  class Processing::App
2
5
  include Java::MonkstoneVideoevent::MovieEvent
3
6
  include Java::MonkstoneVideoevent::CaptureEvent
@@ -11,21 +11,21 @@ WARNING = <<~WARN
11
11
 
12
12
  WARN
13
13
  # https://github.com/processing/processing-video/releases/download/r6-v2.0-beta4/video-2.0-beta4.zip
14
- JRUBYC_VERSION = '9.2.9.0'
14
+ JRUBYC_VERSION = '9.2.14.0'
15
15
  SOUND = 'sound.zip'
16
- SOUND_VERSION = 'v2.2.2'
17
- VIDEO = 'video-2.0-beta4.zip'
18
- VIDEO_VERSION = 'r6-v2.0-beta4'
19
- EXAMPLES = '3.5'
16
+ SOUND_VERSION = 'v2.2.3'
17
+ VIDEO = 'video.zip'
18
+ VIDEO_VERSION = 'v2.0'
19
+ EXAMPLES = '3.9'
20
20
  HOME_DIR = ENV['HOME']
21
- MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
22
-
21
+ MAC_OR_LINUX = /linux|mac|darwin/.match?(RbConfig::CONFIG['host_os'])
22
+ DOWNLOAD = 'releases/download/latest'
23
23
  CLOBBER << "jruby-complete-#{JRUBYC_VERSION}.jar"
24
24
  CLOBBER << "jruby-complete-#{JRUBYC_VERSION}.jar.sha256"
25
25
 
26
26
  desc 'dependency check'
27
27
  task :wget_check do
28
- WGET ||= `which wget`
28
+ WGET ||= `which wget`.freeze
29
29
  warn WARNING unless WGET
30
30
  end
31
31
 
@@ -82,15 +82,15 @@ task :init_dir do
82
82
  end
83
83
 
84
84
  desc 'download and copy sound library to ~/.jruby_art'
85
- task download_and_copy_sound: %i[wget_check init_dir download_sound copy_sound clobber]
85
+ task install_sound: %i[wget_check init_dir download_sound copy_sound clobber]
86
86
 
87
87
  desc 'download and copy video library to ~/.jruby_art'
88
- task download_and_copy_video: %i[wget_check init_dir download_video copy_video clobber]
88
+ task install_video: %i[wget_check init_dir download_video copy_video clobber]
89
89
 
90
90
  desc 'download sound library'
91
91
  task :download_sound do
92
92
  wget_base = 'wget https://github.com/processing/processing-sound'
93
- wget_string = [wget_base, 'releases/download/latest', SOUND].join('/')
93
+ wget_string = [wget_base, DOWNLOAD, SOUND].join('/')
94
94
  puts wget_string
95
95
  system wget_string
96
96
  end
@@ -98,22 +98,26 @@ end
98
98
  desc 'download video library'
99
99
  task :download_video do
100
100
  wget_base = 'wget https://github.com/processing/processing-video'
101
- wget_string = [wget_base, 'releases/download', VIDEO_VERSION, VIDEO].join('/')
101
+ wget_string = [wget_base, DOWNLOAD, VIDEO].join('/')
102
102
  system wget_string
103
103
  end
104
104
 
105
105
  desc 'copy sound library'
106
- task copy_sound: SOUND do
106
+ task :copy_sound do
107
107
  system "unzip #{SOUND}"
108
- FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/sound" if File.exist? "#{HOME_DIR}/.jruby_art/libraries/sound"
108
+ if File.exist? "#{HOME_DIR}/.jruby_art/libraries/sound"
109
+ FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/sound"
110
+ end
109
111
  FileUtils.cp_r 'sound', "#{HOME_DIR}/.jruby_art/libraries"
110
112
  FileUtils.rm_r 'sound'
111
113
  end
112
114
 
113
115
  desc 'copy video library'
114
- task copy_video: VIDEO do
116
+ task :copy_video do
115
117
  system "unzip #{VIDEO}"
116
- FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/video" if File.exist? "#{HOME_DIR}/.jruby_art/libraries/video"
118
+ if File.exist? "#{HOME_DIR}/.jruby_art/libraries/video"
119
+ FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/video"
120
+ end
117
121
  FileUtils.cp_r 'video', "#{HOME_DIR}/.jruby_art/libraries/video"
118
122
  FileUtils.rm_r 'video'
119
123
  end
@@ -139,7 +143,9 @@ task copy_examples: file_name do
139
143
  else
140
144
  system "tar xzvf #{EXAMPLES}.tar.gz"
141
145
  end
142
- FileUtils.rm_r("#{HOME_DIR}/k9_samples") if File.exist? "#{HOME_DIR}/k9_samples"
146
+ if File.exist? "#{HOME_DIR}/k9_samples"
147
+ FileUtils.rm_r("#{HOME_DIR}/k9_samples")
148
+ end
143
149
  FileUtils.cp_r("JRubyArt-examples-#{EXAMPLES}", "#{HOME_DIR}/k9_samples")
144
150
  FileUtils.rm_r("JRubyArt-examples-#{EXAMPLES}")
145
151
  end
metadata CHANGED
@@ -1,45 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby_art
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Prout
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-22 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '12.3'
18
+ version: '5.10'
19
+ name: minitest
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '12.3'
26
+ version: '5.10'
27
27
  - !ruby/object:Gem::Dependency
28
- name: minitest
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '5.10'
32
+ version: '12.3'
33
+ name: rake
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.10'
40
+ version: '12.3'
41
41
  description: |2
42
- JRubyArt-2.0+ is a ruby implementation of the processing art framework, with enhanced
42
+ JRubyArt-2.4.0+ is a ruby implementation of the processing art framework, with enhanced
43
43
  functionality. Processing libraries and ruby gems can be used in your sketches.
44
44
  Features create/run/watch/live modes.
45
45
  email: mamba2928@yahoo.co.uk
@@ -57,7 +57,7 @@ files:
57
57
  - lib/jogl-all-natives-macosx-universal.jar
58
58
  - lib/jogl-all-natives-windows-amd64.jar
59
59
  - lib/jogl-all.jar
60
- - lib/jruby_art-2.2.2.jar
60
+ - lib/jruby_art-2.4.3.jar
61
61
  - lib/jruby_art.rb
62
62
  - lib/jruby_art/app.rb
63
63
  - lib/jruby_art/config.rb
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '2.3'
110
+ version: '2.5'
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - ">="
@@ -117,7 +117,7 @@ requirements:
117
117
  - A decent graphics card
118
118
  - java runtime >= 11.0.3+
119
119
  rubygems_version: 3.0.6
120
- signing_key:
120
+ signing_key:
121
121
  specification_version: 4
122
122
  summary: Code as Art, Art as Code. Processing and Ruby are meant for each other.
123
123
  test_files: []
Binary file