propane 2.0.4-java → 2.0.5-java

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: b8a56b1bfc4c73b83741bc7e847298d4b3d0e35c
4
- data.tar.gz: fa2f47690147a25f9f23b229924969011e618d3c
3
+ metadata.gz: 5794ce5b552d6e659f1f8be32ddf767a6a1dc62b
4
+ data.tar.gz: 2df804a15ad3310758a389505f7dd662e94c95f6
5
5
  SHA512:
6
- metadata.gz: ff02e67b5b2eb154820b51f2271e12a3f8af13c18e2f82fd8ee4f09b5dfd379c3884e8f5ac4c561e5f2068334ec4fb3497471f0bf6e5682aeade7fc6dc874662
7
- data.tar.gz: 43e964fe32d9870740fef91680cc9e785f364aa227ec1916ce699f453955cb465a7662476f198979f9a3689d454af17120424072deb643dfdb9410b036fdfa02
6
+ metadata.gz: 57cd3ed713c358931fb654e1d15408db641962bfcddc3a617c064a1bfe67263d4e691757ec85525a146a46a8d7bef373092effac79346290e54f79c9d6fd5f2c
7
+ data.tar.gz: 3719b85da86446105118d3e1e688264d2fa26c40c083d3e25b1b63716c16e4258005a8eb91918fa6a525b1557f404852a95317fc1ea5f251faddceb541aac1c3
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.1.18</version>
6
+ <version>0.1.19</version>
7
7
  </extension>
8
8
  </extensions>
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
+ **v2.0.5** Update to processing-3.2.2, fix local library load, add proxy_library expand samples
2
+
1
3
  **v2.0.4** Correct `norm_strict`, add `math_tool_test` add `simplex_noise` expand samples
4
+
2
5
  **v2.0.3** Suggest use of jruby-9.1.4.0, more about loading vanilla libraries
6
+
3
7
  **v2.0.2** Refactor install to either install `samples\sound\video` or warn (update to use a local processing-3.2.1 core, this is why travis fails), fix some examples, hence `0.3`
4
8
 
5
9
  **v2.0.1** Support processing-3.2.0
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ def create_manifest
7
7
  File.open('MANIFEST.MF', 'w') do |f|
8
8
  f.puts(title)
9
9
  f.puts(version)
10
- f.puts('Class-Path: core-3.2.1.jar gluegen-rt-2.3.2.jar jog-all-2.3.2.jar')
10
+ f.puts('Class-Path: core-3.2.2.jar gluegen-rt-2.3.2.jar jog-all-2.3.2.jar')
11
11
  end
12
12
  end
13
13
 
@@ -98,6 +98,7 @@ module Propane
98
98
  extensions = extension ? [extension] : %w(jar rb)
99
99
  extensions.each do |ext|
100
100
  [
101
+ "#{SKETCH_ROOT}/library/#{library_name}",
101
102
  "#{PROPANE_ROOT}/library/#{library_name}",
102
103
  "#{PROPANE_ROOT}/library/#{library_name}/library",
103
104
  "#{PROPANE_ROOT}/library/#{library_name}",
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
  module Propane
4
- VERSION = '2.0.4'.freeze
4
+ VERSION = '2.0.5'.freeze
5
5
  end
@@ -0,0 +1,99 @@
1
+ ### Using the LibraryProxy in your sketches
2
+ LibraryProxy is a [abstract java class](https://github.com/ruby-processing/JRubyArt/blob/master/src/monkstone/core/LibraryProxy.java) so that you can acccess vanilla processing library reflection methods in your sketches using ruby.
3
+
4
+ In the sketch you should `load_library :library_proxy` and your library class should inherit
5
+ from LibraryProxy and implement pre(), draw() and post() methods (can be empty method if not
6
+ required). For simplicity initialize your `processing library` in the sketch `setup`.
7
+
8
+ ### Example library
9
+
10
+ ```ruby
11
+ require 'forwardable'
12
+
13
+ # A custom Array created using forwardable (that can also access the PApplet pre,
14
+ # post and draw loops by extending our new LibraryProxy class. Also has access
15
+ # to custom background(int), fill(int) and stroke(int) methods.
16
+ class CustomArray < LibraryProxy
17
+ extend Forwardable
18
+ def_delegators(:@objs, :each, :<<)
19
+ include Enumerable
20
+
21
+ attr_reader :app
22
+
23
+ # We must initialize class with the PApplet instance
24
+ def initialize(app)
25
+ @app = app
26
+ @objs = []
27
+ end
28
+
29
+ def add_object(mx, my, x, y, speed)
30
+ self << Particle.new(x.to_i, y.to_i, mx, my, Sketch::UNIT, speed, 1, 1)
31
+ end
32
+
33
+ # Access the processing post loop (gets called after draw)
34
+ def post
35
+ each do |obj|
36
+ update_x obj
37
+ next unless obj.y >= Sketch::UNIT || obj.x <= 0
38
+ obj.ydir *= -1
39
+ obj.y += obj.ydir
40
+ end
41
+ end
42
+
43
+ def update_x(obj)
44
+ obj.x += obj.speed * obj.xdir
45
+ return if (0..Sketch::UNIT).cover? obj.x
46
+ obj.xdir *= -1
47
+ obj.x += obj.xdir
48
+ obj.y += obj.ydir
49
+ end
50
+
51
+ # We need this to fulfill the contract of implementing abstract methods of
52
+ # LibraryProxy which is an alias for Java::ProcessingCore::AbstractLibrary
53
+ def pre
54
+ end
55
+
56
+ # Access the processing draw loop here, using our custom background and fill
57
+ # note: use of 'app' to access ellipse functionality as would otherwise be
58
+ # required for background and fill
59
+ def draw
60
+ background(0)
61
+ fill(255)
62
+ each do |obj|
63
+ app.ellipse(obj.mx + obj.x, obj.my + obj.y, 6, 6)
64
+ end
65
+ end
66
+ end
67
+
68
+ # The Particle object
69
+
70
+ Particle = Struct.new(:x, :y, :mx, :my, :size, :speed, :xdir, :ydir)
71
+ ```
72
+ ### Example sketch
73
+
74
+ ```ruby
75
+ # A minimalist sketch that demonstrates a possible approach to creating a custom
76
+ # array of objects using forwardable. Also demonstrates how to use LibraryProxy.
77
+
78
+ load_library :library_proxy # loads the JRubyArt LibraryProxy abstract class
79
+ require_relative 'custom_array' # loads our custom 'library' class
80
+
81
+ UNIT = 40
82
+
83
+ def setup
84
+ size 640, 360
85
+ wide_count = width / UNIT
86
+ height_count = height / UNIT
87
+ custom_array = CustomArray.new(self)
88
+ height_count.times do |i|
89
+ wide_count.times do |j|
90
+ custom_array.add_object(j * UNIT, i * UNIT, UNIT / 2, UNIT / 2, rand(0.05..0.8))
91
+ end
92
+ end
93
+ no_stroke
94
+ end
95
+
96
+ # does nothing here see custom_array.rb
97
+ def draw
98
+ end
99
+ ```
@@ -0,0 +1,12 @@
1
+ java_import Java::MonkstoneCore::LibraryProxy
2
+
3
+
4
+ # classes that inherit from Library are expected to implement
5
+ # the abstract methods of monkstone.core.LibraryProxy
6
+ # def pre...
7
+ # def draw...
8
+ # def post...
9
+ # def keyPressed...
10
+ # def mousePressed...
11
+ # NOOP is fine...
12
+ # `app` can be called to get PApplet instance
data/pom.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
  project 'rp5extras', 'https://github.com/monkstone/propane' do
3
3
  model_version '4.0.0'
4
- id 'propane:propane', '2.0.4'
4
+ id 'propane:propane', '2.0.5'
5
5
  packaging 'jar'
6
6
  description 'rp5extras for propane'
7
7
  organization 'ruby-processing', 'https://ruby-processing.github.io'
@@ -11,15 +11,15 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
11
11
  roles 'developer'
12
12
  end
13
13
  end
14
- license 'GPL 3', 'http://www.gnu.org/licenses/gpl-3.0-standalone.html'
14
+ license 'GPL 3', 'http://www.gnu.org/licenses/gpl-3.0-standalone.html'
15
15
  issue_management 'https://github.com/ruby-processing/propane/issues', 'Github'
16
-
16
+
17
17
  source_control(
18
18
  url: 'https://github.com/ruby-processing/propane',
19
19
  connection: 'scm:git:git://github.com/ruby-processing/propane.git',
20
20
  developer_connection: 'scm:git:git@github.com/ruby-processing/propane.git'
21
21
  )
22
-
22
+
23
23
  properties('source.directory' => 'src',
24
24
  'propane.basedir' => '${project.basedir}',
25
25
  'polyglot.dump.pom' => 'pom.xml',
@@ -31,20 +31,20 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
31
31
  'jruby.api' => 'http://jruby.org/apidocs/',
32
32
  'jogl.version' => '2.3.2'
33
33
  )
34
-
34
+
35
35
  pom 'org.jruby:jruby:9.1.5.0'
36
- jar 'org.processing:core:3.2.1'
36
+ jar 'org.processing:core:3.2.2'
37
37
  jar 'org.processing:video:3.0.2'
38
38
  jar('org.jogamp.jogl:jogl-all:${jogl.version}')
39
39
  jar('org.jogamp.gluegen:gluegen-rt-main:${jogl.version}')
40
-
40
+
41
41
  overrides do
42
42
  plugin :resources, '2.6'
43
43
  plugin :dependency, '2.10' do
44
44
  execute_goals( id: 'default-cli',
45
45
  artifactItems: [ { groupId: 'org.processing',
46
46
  artifactId: 'core',
47
- version: '3.2.1',
47
+ version: '3.2.2',
48
48
  type: 'jar',
49
49
  outputDirectory: '${propane.basedir}/lib'
50
50
  },
@@ -91,8 +91,8 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
91
91
  ]
92
92
  )
93
93
  end
94
-
95
- plugin( :compiler, '3.5.1',
94
+
95
+ plugin( :compiler, '3.6.0',
96
96
  source: '${maven.compiler.source}',
97
97
  target: '${maven.compiler.target}'
98
98
  )
data/pom.xml CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
11
11
  <modelVersion>4.0.0</modelVersion>
12
12
  <groupId>propane</groupId>
13
13
  <artifactId>propane</artifactId>
14
- <version>2.0.4</version>
14
+ <version>2.0.5</version>
15
15
  <name>rp5extras</name>
16
16
  <description>rp5extras for propane</description>
17
17
  <url>https://github.com/monkstone/propane</url>
@@ -64,7 +64,7 @@ DO NOT MODIFIY - GENERATED CODE
64
64
  <dependency>
65
65
  <groupId>org.processing</groupId>
66
66
  <artifactId>core</artifactId>
67
- <version>3.2.1</version>
67
+ <version>3.2.2</version>
68
68
  </dependency>
69
69
  <dependency>
70
70
  <groupId>org.processing</groupId>
@@ -103,7 +103,7 @@ DO NOT MODIFIY - GENERATED CODE
103
103
  <artifactItem>
104
104
  <groupId>org.processing</groupId>
105
105
  <artifactId>core</artifactId>
106
- <version>3.2.1</version>
106
+ <version>3.2.2</version>
107
107
  <type>jar</type>
108
108
  <outputDirectory>${propane.basedir}/lib</outputDirectory>
109
109
  </artifactItem>
@@ -160,7 +160,7 @@ DO NOT MODIFIY - GENERATED CODE
160
160
  </plugin>
161
161
  <plugin>
162
162
  <artifactId>maven-compiler-plugin</artifactId>
163
- <version>3.5.1</version>
163
+ <version>3.6.0</version>
164
164
  <configuration>
165
165
  <source>${maven.compiler.source}</source>
166
166
  <target>${maven.compiler.target}</target>
data/propane.gemspec CHANGED
@@ -9,12 +9,12 @@ Gem::Specification.new do |gem|
9
9
  gem.authors = ['monkstone']
10
10
  gem.email = ['mamba2928@yahoo.co.uk']
11
11
  gem.licenses = %w(GPL-3.0 LGPL-2.0)
12
- gem.description = %q{A batteries included version of processing in ruby}
13
- gem.summary = %q{A jruby wrapper for processing-3.2.1}
12
+ gem.description = %q{A batteries included version of processing in ruby, macOS and linux}
13
+ gem.summary = %q{A jruby wrapper for processing-3.2.2}
14
14
  gem.homepage = 'https://ruby-processing.github.io/propane/'
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.files << 'lib/propane.jar'
17
- gem.files << 'lib/core-3.2.1.jar'
17
+ gem.files << 'lib/core-3.2.2.jar'
18
18
  gem.files << 'lib/gluegen-rt-2.3.2.jar'
19
19
  gem.files << 'lib/jogl-all-2.3.2.jar'
20
20
  gem.files << 'lib/gluegen-rt-2.3.2-natives-linux-amd64.jar'
@@ -1,5 +1,6 @@
1
1
  package monkstone.core;
2
2
 
3
+ import processing.core.PApplet;
3
4
  import static processing.core.PConstants.*;
4
5
 
5
6
  /**
@@ -10,9 +11,9 @@ import static processing.core.PConstants.*;
10
11
  * PConstants should also be available from static import
11
12
  * @author Martin Prout
12
13
  */
13
- public abstract class AbstractLibrary {
14
+ public abstract class LibraryProxy {
14
15
 
15
- private final processing.core.PApplet app;
16
+ private final PApplet app;
16
17
 
17
18
  /**
18
19
  * Useful accessors
@@ -23,7 +24,7 @@ public abstract class AbstractLibrary {
23
24
  *
24
25
  * @param app PApplet
25
26
  */
26
- public AbstractLibrary(processing.core.PApplet app) {
27
+ public LibraryProxy(PApplet app) {
27
28
  this.app = app;
28
29
  this.width = app.width;
29
30
  this.height = app.height;
@@ -48,7 +49,11 @@ public abstract class AbstractLibrary {
48
49
  */
49
50
  public abstract void post();
50
51
 
51
- private void setActive(boolean active) {
52
+ /**
53
+ * Register or unregister reflection methods
54
+ * @param active
55
+ */
56
+ final void setActive(boolean active) {
52
57
  if (active) {
53
58
  this.app.registerMethod("pre", this);
54
59
  this.app.registerMethod("draw", this);
@@ -63,7 +68,7 @@ public abstract class AbstractLibrary {
63
68
 
64
69
  /**
65
70
  * Simple signature for background hides need to call app
66
- * @param col
71
+ * @param col int
67
72
  */
68
73
  public void background(int col) {
69
74
  this.app.background(col);
@@ -71,7 +76,7 @@ public abstract class AbstractLibrary {
71
76
 
72
77
  /**
73
78
  * Simple signature for fill hides need to call app
74
- * @param col
79
+ * @param col int
75
80
  */
76
81
  public void fill(int col) {
77
82
  this.app.fill(col);
@@ -79,7 +84,7 @@ public abstract class AbstractLibrary {
79
84
 
80
85
  /**
81
86
  * Simple signature for stroke hides need to call app
82
- * @param col
87
+ * @param col int
83
88
  */
84
89
  public void stroke(int col) {
85
90
  this.app.stroke(col);
@@ -87,9 +92,9 @@ public abstract class AbstractLibrary {
87
92
 
88
93
  /**
89
94
  * Access applet if we must
90
- * @return app PApplet
95
+ * @return applet PApplet
91
96
  */
92
- public processing.core.PApplet app() {
97
+ public PApplet app() {
93
98
  return this.app;
94
99
  }
95
100
 
data/vendors/Rakefile CHANGED
@@ -9,7 +9,7 @@ SOUND = 'sound.zip'.freeze
9
9
  SOUND_VERSION = 'v1.3.2' # version 1.3.2
10
10
  VIDEO = 'video-2.zip'
11
11
  VIDEO_VERSION = '2' # version 1.0.1
12
- EXAMPLES = '0.4'.freeze
12
+ EXAMPLES = '0.5'.freeze
13
13
  HOME_DIR = ENV['HOME']
14
14
  MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: java
6
6
  authors:
7
7
  - monkstone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-26 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arcball
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.0.3
27
- description: A batteries included version of processing in ruby
27
+ description: A batteries included version of processing in ruby, macOS and linux
28
28
  email:
29
29
  - mamba2928@yahoo.co.uk
30
30
  executables:
@@ -45,7 +45,7 @@ files:
45
45
  - Rakefile
46
46
  - bin/propane
47
47
  - lib/PROCESSING_LICENSE.txt
48
- - lib/core-3.2.1.jar
48
+ - lib/core-3.2.2.jar
49
49
  - lib/export.txt
50
50
  - lib/gluegen-rt-2.3.2-natives-linux-amd64.jar
51
51
  - lib/gluegen-rt-2.3.2-natives-macosx-universal.jar
@@ -67,6 +67,8 @@ files:
67
67
  - library/control_panel/control_panel.rb
68
68
  - library/file_chooser/chooser.rb
69
69
  - library/file_chooser/file_chooser.rb
70
+ - library/library_proxy/README.md
71
+ - library/library_proxy/library_proxy.rb
70
72
  - library/simplex_noise/simplex_noise.rb
71
73
  - library/slider/slider.rb
72
74
  - library/video_event/video_event.rb
@@ -76,7 +78,7 @@ files:
76
78
  - src/monkstone/ColorUtil.java
77
79
  - src/monkstone/MathToolModule.java
78
80
  - src/monkstone/PropaneLibrary.java
79
- - src/monkstone/core/AbstractLibrary.java
81
+ - src/monkstone/core/LibraryProxy.java
80
82
  - src/monkstone/fastmath/Deglut.java
81
83
  - src/monkstone/fastmath/package-info.java
82
84
  - src/monkstone/filechooser/Chooser.java
@@ -129,7 +131,7 @@ rubyforge_project:
129
131
  rubygems_version: 2.6.3
130
132
  signing_key:
131
133
  specification_version: 4
132
- summary: A jruby wrapper for processing-3.2.1
134
+ summary: A jruby wrapper for processing-3.2.2
133
135
  test_files:
134
136
  - test/create_test.rb
135
137
  - test/deglut_spec_test.rb