propane 3.4.2-java → 3.8.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +2 -2
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -2
  5. data/.travis.yml +1 -1
  6. data/CHANGELOG.md +9 -1
  7. data/Gemfile +2 -0
  8. data/README.md +7 -10
  9. data/Rakefile +10 -11
  10. data/bin/propane +3 -1
  11. data/lib/propane.rb +4 -2
  12. data/lib/propane/app.rb +5 -1
  13. data/lib/propane/creators/sketch_class.rb +7 -1
  14. data/lib/propane/creators/sketch_factory.rb +4 -2
  15. data/lib/propane/creators/sketch_writer.rb +1 -0
  16. data/lib/propane/helper_methods.rb +22 -23
  17. data/lib/propane/helpers/numeric.rb +2 -0
  18. data/lib/propane/helpers/version_error.rb +1 -0
  19. data/lib/propane/library.rb +5 -1
  20. data/lib/propane/library_loader.rb +2 -0
  21. data/lib/propane/native_folder.rb +10 -9
  22. data/lib/propane/native_loader.rb +3 -0
  23. data/lib/propane/runner.rb +20 -14
  24. data/lib/propane/version.rb +2 -1
  25. data/library/boids/boids.rb +21 -11
  26. data/library/color_group/color_group.rb +2 -0
  27. data/library/control_panel/control_panel.rb +8 -5
  28. data/library/dxf/dxf.rb +2 -0
  29. data/library/file_chooser/chooser.rb +10 -9
  30. data/library/file_chooser/file_chooser.rb +10 -9
  31. data/library/library_proxy/library_proxy.rb +2 -0
  32. data/library/net/net.rb +2 -0
  33. data/library/slider/slider.rb +23 -22
  34. data/library/vector_utils/vector_utils.rb +4 -0
  35. data/library/video_event/video_event.rb +2 -0
  36. data/pom.rb +37 -36
  37. data/pom.xml +7 -7
  38. data/propane.gemspec +13 -9
  39. data/src/main/java/japplemenubar/JAppleMenuBar.java +3 -3
  40. data/src/main/java/monkstone/ColorUtil.java +1 -3
  41. data/src/main/java/monkstone/MathToolModule.java +1 -1
  42. data/src/main/java/monkstone/PropaneLibrary.java +2 -2
  43. data/src/main/java/monkstone/fastmath/DegLutTables.java +111 -0
  44. data/src/main/java/monkstone/fastmath/Deglut.java +6 -56
  45. data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
  46. data/src/main/java/monkstone/noise/Noise.java +116 -0
  47. data/src/main/java/monkstone/noise/NoiseGenerator.java +63 -0
  48. data/src/main/java/monkstone/noise/NoiseMode.java +15 -0
  49. data/src/main/java/monkstone/noise/SimplexNoise.java +137 -103
  50. data/src/main/java/monkstone/noise/ValueNoise.java +170 -0
  51. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  52. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  53. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  54. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  55. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  56. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  57. data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
  58. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  59. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
  60. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -2
  61. data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
  62. data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
  63. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  64. data/src/main/java/processing/awt/PGraphicsJava2D.java +781 -285
  65. data/src/main/java/processing/awt/PImageAWT.java +377 -0
  66. data/src/main/java/processing/awt/PShapeJava2D.java +56 -52
  67. data/src/main/java/processing/awt/PSurfaceAWT.java +308 -208
  68. data/src/main/java/processing/awt/ShimAWT.java +581 -0
  69. data/src/main/java/processing/core/PApplet.java +13142 -13883
  70. data/src/main/java/processing/core/PConstants.java +477 -447
  71. data/src/main/java/processing/core/PFont.java +914 -880
  72. data/src/main/java/processing/core/PGraphics.java +152 -136
  73. data/src/main/java/processing/core/PImage.java +275 -372
  74. data/src/main/java/processing/core/PMatrix.java +172 -159
  75. data/src/main/java/processing/core/PMatrix2D.java +478 -415
  76. data/src/main/java/processing/core/PMatrix3D.java +762 -735
  77. data/src/main/java/processing/core/PShape.java +2887 -2651
  78. data/src/main/java/processing/core/PShapeOBJ.java +97 -92
  79. data/src/main/java/processing/core/PShapeSVG.java +1705 -1490
  80. data/src/main/java/processing/core/PStyle.java +40 -37
  81. data/src/main/java/processing/core/PSurface.java +139 -97
  82. data/src/main/java/processing/core/PSurfaceNone.java +296 -218
  83. data/src/main/java/processing/core/PVector.java +995 -963
  84. data/src/main/java/processing/core/ThinkDifferent.java +12 -8
  85. data/src/main/java/processing/data/DoubleDict.java +756 -710
  86. data/src/main/java/processing/data/DoubleList.java +749 -696
  87. data/src/main/java/processing/data/FloatDict.java +748 -702
  88. data/src/main/java/processing/data/FloatList.java +751 -697
  89. data/src/main/java/processing/data/IntDict.java +720 -673
  90. data/src/main/java/processing/data/IntList.java +699 -633
  91. data/src/main/java/processing/data/JSONArray.java +931 -873
  92. data/src/main/java/processing/data/JSONObject.java +1262 -1165
  93. data/src/main/java/processing/data/JSONTokener.java +351 -341
  94. data/src/main/java/processing/data/LongDict.java +710 -663
  95. data/src/main/java/processing/data/LongList.java +701 -635
  96. data/src/main/java/processing/data/Sort.java +37 -41
  97. data/src/main/java/processing/data/StringDict.java +525 -486
  98. data/src/main/java/processing/data/StringList.java +626 -580
  99. data/src/main/java/processing/data/Table.java +3690 -3510
  100. data/src/main/java/processing/data/TableRow.java +182 -183
  101. data/src/main/java/processing/data/XML.java +957 -883
  102. data/src/main/java/processing/event/Event.java +87 -67
  103. data/src/main/java/processing/event/KeyEvent.java +48 -41
  104. data/src/main/java/processing/event/MouseEvent.java +88 -113
  105. data/src/main/java/processing/event/TouchEvent.java +10 -6
  106. data/src/main/java/processing/javafx/PGraphicsFX2D.java +20 -345
  107. data/src/main/java/processing/javafx/PSurfaceFX.java +149 -121
  108. data/src/main/java/processing/net/Client.java +20 -20
  109. data/src/main/java/processing/net/Server.java +9 -9
  110. data/src/main/java/processing/opengl/FontTexture.java +286 -266
  111. data/src/main/java/processing/opengl/FrameBuffer.java +389 -377
  112. data/src/main/java/processing/opengl/LinePath.java +132 -89
  113. data/src/main/java/processing/opengl/LineStroker.java +588 -581
  114. data/src/main/java/processing/opengl/PGL.java +660 -567
  115. data/src/main/java/processing/opengl/PGraphics2D.java +408 -315
  116. data/src/main/java/processing/opengl/PGraphics3D.java +107 -72
  117. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12378 -12075
  118. data/src/main/java/processing/opengl/PJOGL.java +1753 -1670
  119. data/src/main/java/processing/opengl/PShader.java +369 -461
  120. data/src/main/java/processing/opengl/PShapeOpenGL.java +4678 -4580
  121. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1114 -1027
  122. data/src/main/java/processing/opengl/Texture.java +1492 -1401
  123. data/src/main/java/processing/opengl/VertexBuffer.java +57 -55
  124. data/test/create_test.rb +21 -20
  125. data/test/deglut_spec_test.rb +4 -2
  126. data/test/helper_methods_test.rb +49 -20
  127. data/test/math_tool_test.rb +39 -32
  128. data/test/native_folder.rb +47 -0
  129. data/test/respond_to_test.rb +3 -2
  130. data/test/sketches/key_event.rb +2 -2
  131. data/test/sketches/library/my_library/my_library.rb +3 -0
  132. data/test/test_helper.rb +2 -0
  133. data/test/vecmath_spec_test.rb +35 -22
  134. data/vendors/Rakefile +35 -40
  135. metadata +47 -23
  136. data/library/simplex_noise/simplex_noise.rb +0 -3
  137. data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
  138. data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
  139. data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
  140. data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6230638aa8f3fba662a21f16d203f35d4e54cbf8fa90f3d35aeec00aeae0aed
4
- data.tar.gz: 62b86da2a9d1b46fa7f2f09463be5edbfd1d05336adf79ae17df362382b1fa34
3
+ metadata.gz: 5df47b4eba645e3b5de5e4c6bbcd5af6c2955cc2e34c326fcb712b967d272c2e
4
+ data.tar.gz: fd791b044c4780f082aa2f6660a7818266603fd6fdcbb6463c8af6c42e34a41d
5
5
  SHA512:
6
- metadata.gz: 8f8c4c2177460c3b96817b7c870de6312ebf864853216f3039bc33fec3ae97e713c4fe31c829a4e39d7e4aea56537cddece1399b772a0432e2d7695ec0f19e37
7
- data.tar.gz: 286d27b5c13890175871709260d4a117545bf203679a40672518927a20a51940266cc5ae8293024d01a76f02f4ceac5ecdae61b686d9cf2f7259743500ea7b26
6
+ metadata.gz: 49bab01156deeea38dc4710486fa371dc93a0b0056f7e93d5110fc2343f4477093fcbd2cc50cc7d3153668916d80ed1dff74a0e3fdcce652784d0d6d8d99c90a
7
+ data.tar.gz: 752c53bb1719652fc1b11514add89b0dff33b2dba23b72ed44db0c58a3d86b99373d1f69f7d928c12e829fb4d1b942da89805d3d4dc3c427bcc36477d60abd75
data/.mvn/extensions.xml CHANGED
@@ -3,6 +3,6 @@
3
3
  <extension>
4
4
  <groupId>io.takari.polyglot</groupId>
5
5
  <artifactId>polyglot-ruby</artifactId>
6
- <version>0.4.4</version>
6
+ <version>0.4.6</version>
7
7
  </extension>
8
8
  </extensions>
@@ -20,7 +20,7 @@ import java.util.Properties;
20
20
 
21
21
  public class MavenWrapperDownloader {
22
22
 
23
- private static final String WRAPPER_VERSION = "0.5.5";
23
+ private static final String WRAPPER_VERSION = "0.5.6";
24
24
  /**
25
25
  * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26
26
  */
@@ -89,7 +89,7 @@ public class MavenWrapperDownloader {
89
89
  System.exit(0);
90
90
  } catch (Throwable e) {
91
91
  System.out.println("- Error downloading");
92
- e.printStackTrace();
92
+
93
93
  System.exit(1);
94
94
  }
95
95
  }
@@ -1,2 +1,2 @@
1
- distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip
2
- wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
1
+ distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2
+ wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
data/.travis.yml CHANGED
@@ -2,7 +2,7 @@ language: java
2
2
  dist: bionic
3
3
 
4
4
  rvm:
5
- - jruby-9.2.9.0
5
+ - jruby-9.2.12.0
6
6
  jdk:
7
7
  - openjdk11
8
8
  os:
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
+ **v3.8.0** Refactor noise to delegate pattern, improve default implementation and add simplex noise option
2
+
3
+ **v3.7.1** Recommend JRuby-9.2.15.0 use
4
+
5
+ **v3.5.0** Rebase processing core code around Sam Pottingers latest fixes for JOGL an image save, does mean breaking some of Diwis and Joshua Davis examples, but one hopes codeanticode knows what he's doing.
6
+
7
+ **v3.4.3** Use Map.of to initialize HashMap bump processing version in build bump to jruby-9.2.11.0
8
+
1
9
  **v3.4.2** Fix native library bug on windows (thanks to Jay Scott). Add minim library examples
2
10
 
3
- **v3.4.1** Update to JRuby-9.2.9.0
11
+ **v3.4.1** Update to jruby-9.2.9.0
4
12
 
5
13
  **v3.4.0** Experimental refactoring of ThinkDifferent, and some other processing classes
6
14
 
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/README.md CHANGED
@@ -8,12 +8,10 @@ adjust above for your OS/distro setup.
8
8
 
9
9
  ## Requirements
10
10
 
11
- There may be a linker issue with P2D or P3D sketches with stock openjdk with some linux distros, in which case you might find [Adopt open jdk binaries][adopt] will work for you.
11
+ Previously there has been linker issue with P2D or P3D sketches with stock openjdk with some linux distros, but that seems to have gone away. [Adopt open jdk binaries][adopt] have always worked.
12
12
 
13
- - `jdk-11.0.3+`
14
- - `jruby-9.2.9.0`
15
-
16
- Currently you can ignore `illegal reflective access` warnings, see [here how to suppress them][warning].
13
+ - `jdk-11.0.7+`
14
+ - `jruby-9.2.16.0`
17
15
 
18
16
  ## Building and testing
19
17
 
@@ -27,10 +25,10 @@ rake javadoc
27
25
 
28
26
  ```bash
29
27
  jgem install propane # from rubygems
30
- jgem install propane-3.4.2-java.gem # local install
28
+ jgem install propane-3.8.0-java.gem # local install
31
29
  # Alternative
32
30
  jruby -S gem install propane # from rubygems
33
- jruby -S gem install propane-3.4.2-java.gem # local install
31
+ jruby -S gem install propane-3.8.0-java.gem # local install
34
32
  ```
35
33
 
36
34
  ## Check Install
@@ -39,7 +37,6 @@ To check version and confirm gem bin files are on your path (also checks JDK ver
39
37
  ```bash
40
38
  propane --version
41
39
  ```
42
-
43
40
  ## Usage
44
41
 
45
42
  A propane sketch:-
@@ -91,12 +88,12 @@ See [gh-pages][gh-pages] for more detailed instructions and much more.
91
88
 
92
89
  ## Examples
93
90
 
94
- [Worked Examples](https://github.com/ruby-processing/propane-examples) more to follow, feel free to add your own, especially ruby-2.4
91
+ [Worked Examples](https://github.com/ruby-processing/propane-examples) more to follow, feel free to add your own, especially ruby-2.5
95
92
  + syntax now we can. To install the samples. The samples get copied to `~/propane_samples`. Depends on wget.
96
93
  ```bash
97
94
  propane --install samples
98
95
  ```
99
- please move existing `propane_samples` if you wish to keep them. The current release features several PixelFlow glsl library examples, including a few shadertoy demos as sketches.
96
+ please move existing `propane_samples` if you wish to keep them. The current release features some noise sketches that exploit the new choice of noise implementation.
100
97
 
101
98
  [adopt]: https://adoptopenjdk.net/
102
99
  [building]:http://ruby-processing.github.io/building/building/
data/Rakefile CHANGED
@@ -1,18 +1,17 @@
1
1
  # frozen_string_literal: false
2
+
2
3
  require_relative 'lib/propane/version'
3
4
 
4
- task default: [:init, :compile, :install, :test, :gem]
5
+ task default: %i[init compile install test gem]
5
6
 
6
- # depends on installed processing, with processing on path
7
+ # Currently depends on local jogl-2.4.0 jars on path ~/jogl24
7
8
  desc 'Copy Jars'
8
9
  task :init do
9
- # processing_root = File.dirname(`readlink -f $(which processing)`) # for Archlinux etc
10
- processing_root = File.join(ENV['HOME'], 'processing-3.5.3') # alternative for debian linux etc
11
- jar_dir = File.join(processing_root, 'core', 'library')
12
- opengl = Dir.entries(jar_dir).grep(/amd64|macosx-universal/)
10
+ jogl24 = File.join(ENV['HOME'], 'jogl24')
11
+ opengl = Dir.entries(jogl24).grep(/amd64|universal|arm64/).select { |jar| jar =~ /linux|windows|macosx|ios|/ }
13
12
  opengl.concat %w[jogl-all.jar gluegen-rt.jar]
14
13
  opengl.each do |gl|
15
- FileUtils.cp(File.join(jar_dir, gl), File.join('.', 'lib'))
14
+ FileUtils.cp(File.join(jogl24, gl), File.join('.', 'lib'))
16
15
  end
17
16
  end
18
17
 
@@ -23,17 +22,17 @@ end
23
22
 
24
23
  desc 'Gem'
25
24
  task :gem do
26
- sh 'gem build propane.gemspec'
25
+ sh 'jgem build propane.gemspec'
27
26
  end
28
27
 
29
28
  desc 'Document'
30
29
  task :javadoc do
31
- sh './mvnw javadoc:javadoc'
30
+ sh './mvnw javadoc:javadoc'
32
31
  end
33
32
 
34
33
  desc 'Compile'
35
34
  task :compile do
36
- sh './mvnw package'
35
+ sh './mvnw package'
37
36
  end
38
37
 
39
38
  desc 'JRuby-Complete'
@@ -53,7 +52,7 @@ end
53
52
 
54
53
  desc 'clean'
55
54
  task :clean do
56
- Dir["./**/*.{jar,gem}"].each do |path|
55
+ Dir['./**/*.{jar,gem}'].each do |path|
57
56
  puts "Deleting #{path} ..."
58
57
  File.delete(path)
59
58
  end
data/bin/propane CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env jruby
2
+ # frozen_string_literal: true
3
+
2
4
  unless defined? PROPANE_ROOT
3
- $LOAD_PATH << File.expand_path(File.dirname(__FILE__))
5
+ $LOAD_PATH << __dir__
4
6
  PROPANE_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
5
7
  end
6
8
 
data/lib/propane.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'java'
3
4
  unless defined? PROPANE_ROOT
4
5
  $LOAD_PATH << File.dirname(__dir__)
5
6
  PROPANE_ROOT = File.dirname(__dir__)
6
7
  end
7
- Dir["#{PROPANE_ROOT}/lib/*.jar"].each do |jar|
8
+ Dir["#{PROPANE_ROOT}/lib/*.jar"].sort.each do |jar|
8
9
  require jar
9
10
  end
10
- require_relative 'propane/app'
11
+ require "#{PROPANE_ROOT}/lib/propane/app"
12
+ require "#{PROPANE_ROOT}/lib/propane/helpers/numeric"
data/lib/propane/app.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: false
2
2
 
3
+ require 'jruby'
3
4
  require_relative 'helper_methods'
4
5
  require_relative 'library_loader'
5
6
 
@@ -15,6 +16,9 @@ module Propane
15
16
  java_import 'monkstone.vecmath.ShapeRender'
16
17
  end
17
18
 
19
+ VALUE = Java::MonkstoneNoise::NoiseMode::PERLIN
20
+ SIMPLEX = Java::MonkstoneNoise::NoiseMode::SIMPLEX
21
+
18
22
  # This class is the base class the user should inherit from when making
19
23
  # their own sketch.
20
24
  #
@@ -132,7 +136,7 @@ module Propane
132
136
  @width ||= w
133
137
  @height ||= h
134
138
  @render_mode ||= mode
135
- import_opengl if /opengl/ =~ mode
139
+ import_opengl if /opengl/.match?(mode)
136
140
  super(*args)
137
141
  end
138
142
 
@@ -5,7 +5,10 @@ class SketchClass
5
5
  attr_reader :name, :width, :height, :mode
6
6
 
7
7
  def initialize(name:, width: 150, height: 150, mode: nil)
8
- @name, @width, @height, @mode = name, width, height, mode
8
+ @name = name
9
+ @width = width
10
+ @height = height
11
+ @mode = mode
9
12
  end
10
13
 
11
14
  def class_sketch
@@ -26,6 +29,7 @@ class SketchClass
26
29
 
27
30
  def size
28
31
  return format(' size %d, %d', width.to_i, height.to_i) unless mode
32
+
29
33
  format(' size %d, %d, %s', width.to_i, height.to_i, mode.upcase)
30
34
  end
31
35
 
@@ -36,6 +40,7 @@ class SketchClass
36
40
 
37
41
  def method_lines(name, content = nil)
38
42
  return [format(' def %s', name), '', ' end'] unless content
43
+
39
44
  [format(' def %s', name), content, ' end', '']
40
45
  end
41
46
 
@@ -43,6 +48,7 @@ class SketchClass
43
48
  lines = [
44
49
  '#!/usr/bin/env jruby',
45
50
  '# frozen_string_literal: false',
51
+ '',
46
52
  "require 'propane'",
47
53
  '',
48
54
  class_sketch
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'sketch_writer'
2
4
 
3
5
  class SketchFactory
4
- NAMES = %w[One Two Three]
5
- def initialize(argc)
6
+ NAMES = %w[One Two Three].freeze
7
+ def initialize(_argc)
6
8
  NAMES.each do |name|
7
9
  SketchWriter.new(File.basename(name, '.rb'), width: 300, height: 300).write
8
10
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: false
2
+
2
3
  require_relative 'sketch_class'
3
4
 
4
5
  # The file writer can write a sketch when given instance of Sketch type
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: false
2
+
2
3
  # processing module wrapper
3
- require_relative 'helpers/numeric'
4
4
  module Propane
5
5
  # Provides some convenience methods
6
6
  module HelperMethods
@@ -52,6 +52,7 @@ module Propane
52
52
 
53
53
  def color(*args)
54
54
  return super(*args) unless args.length == 1
55
+
55
56
  super(hex_color(args[0]))
56
57
  end
57
58
 
@@ -66,11 +67,8 @@ module Propane
66
67
  # Overrides Processing convenience function thread, which takes a String
67
68
  # arg (for a function) to more rubylike version, takes a block...
68
69
  def thread(&block)
69
- if block_given?
70
- Thread.new(&block)
71
- else
72
- raise ArgumentError, 'thread must be called with a block', caller
73
- end
70
+ warn 'A Block is Needed' unless block_given?
71
+ Java::JavaLang::Thread.new(&block).start
74
72
  end
75
73
 
76
74
  # explicitly provide 'processing.org' min instance method
@@ -94,9 +92,9 @@ module Propane
94
92
  def dist(*args)
95
93
  case args.length
96
94
  when 4
97
- return dist2d(*args)
95
+ dist2d(*args)
98
96
  when 6
99
- return dist3d(*args)
97
+ dist3d(*args)
100
98
  else
101
99
  raise ArgumentError, 'takes 4 or 6 parameters'
102
100
  end
@@ -111,13 +109,13 @@ module Propane
111
109
  # Here's a convenient way to look for them.
112
110
  def find_method(method_name)
113
111
  reg = Regexp.new(method_name.to_s, true)
114
- methods.sort.select { |meth| reg.match(meth) }
112
+ methods.sort.select { |meth| reg.match?(meth) }
115
113
  end
116
114
 
117
115
  # Proxy over a list of Java declared fields that have the same name as
118
116
  # some methods. Add to this list as needed.
119
117
  def proxy_java_fields
120
- fields = %w(key frameRate mousePressed keyPressed)
118
+ fields = %w[key frameRate mousePressed keyPressed]
121
119
  methods = fields.map { |field| java_class.declared_field(field) }
122
120
  @declared_fields = Hash[fields.zip(methods)]
123
121
  end
@@ -163,6 +161,7 @@ module Propane
163
161
  # frame_rate needs to support reading and writing
164
162
  def frame_rate(fps = nil)
165
163
  return @declared_fields['frameRate'].value(java_self) unless fps
164
+
166
165
  super(fps)
167
166
  end
168
167
 
@@ -178,21 +177,19 @@ module Propane
178
177
 
179
178
  private
180
179
 
181
- INTEGER_COL = -> (x) { x.is_a?(Integer) }
182
- STRING_COL = -> (x) { x.is_a?(String) }
183
- FLOAT_COL = -> (x) { x.is_a?(Float) }
184
180
  # parse single argument color int/double/String
185
- def hex_color(a)
186
- case a
187
- when INTEGER_COL
188
- Java::Monkstone::ColorUtil.colorLong(a)
189
- when STRING_COL
190
- return Java::Monkstone::ColorUtil.colorString(a) if a =~ /#\h+/
191
- raise StandardError, 'Dodgy Hexstring'
192
- when FLOAT_COL
193
- Java::Monkstone::ColorUtil.colorDouble(a)
181
+ def hex_color(arg)
182
+ case arg
183
+ when Integer
184
+ Java::Monkstone::ColorUtil.colorLong(arg)
185
+ when String
186
+ raise 'Dodgy Hexstring' unless /#\h{6}$/.match?(arg)
187
+
188
+ Java::Monkstone::ColorUtil.colorString(arg)
189
+ when Float
190
+ Java::Monkstone::ColorUtil.colorDouble(arg)
194
191
  else
195
- raise StandardError, 'Dodgy Color Conversion'
192
+ raise 'Dodgy Color Conversion'
196
193
  end
197
194
  end
198
195
 
@@ -200,6 +197,7 @@ module Propane
200
197
  dx = args[0] - args[2]
201
198
  dy = args[1] - args[3]
202
199
  return 0 if dx.abs < EPSILON && dy.abs < EPSILON
200
+
203
201
  Math.hypot(dx, dy)
204
202
  end
205
203
 
@@ -208,6 +206,7 @@ module Propane
208
206
  dy = args[1] - args[4]
209
207
  dz = args[2] - args[5]
210
208
  return 0 if dx.abs < EPSILON && dy.abs < EPSILON && dz.abs < EPSILON
209
+
211
210
  Math.sqrt(dx * dx + dy * dy + dz * dz)
212
211
  end
213
212
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Numeric #:nodoc:
2
4
  def degrees
3
5
  self * 57.29577951308232
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  class JDKVersionError < StandardError
3
4
  def message
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'native_folder'
2
4
  require_relative 'native_loader'
3
5
  require 'pathname'
@@ -18,6 +20,7 @@ class Library
18
20
  return if (@path = Pathname.new(
19
21
  File.join(PROPANE_ROOT, 'library', name, "#{name}.rb")
20
22
  )).exist?
23
+
21
24
  locate_java
22
25
  end
23
26
 
@@ -46,10 +49,11 @@ class Library
46
49
  end
47
50
 
48
51
  def load_jars
49
- Dir.glob("#{dir}/*.jar").each do |jar|
52
+ Dir.glob("#{dir}/*.jar").sort.each do |jar|
50
53
  require jar
51
54
  end
52
55
  return true unless native_binaries?
56
+
53
57
  add_binaries_to_classpath
54
58
  end
55
59