ruby-processing 2.6.10 → 2.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f759da899f9b5c76bf20b45d252e5f863d0aa2e
4
- data.tar.gz: 13e1232eaeddceda9786c119b50f388e2725ed5a
3
+ metadata.gz: 95f093af92488a7783924a932a086c10e2e81058
4
+ data.tar.gz: 77868bd9e219521101a104c4d6d0207f77b5c877
5
5
  SHA512:
6
- metadata.gz: 9602c61f20d9a44bc8da342b1ee110ed7d2f9a06b6e2f89d18a0ab6b76a69ca46c6990632742de58d3a7ab38203cce6cb6323026e1435dee74d162308e7e6d49
7
- data.tar.gz: b95d2bebd2e1ed9c1374ac7833a89646d9bbbb0c8f9ff06aeef839d237d73d22ae2847bb692c8aca364237a293054d593aa48019e779f48fa9ad25ea53b7db47
6
+ metadata.gz: 76ad255dc7e19dc407f787523d0c26d1be56cdcfbb8329ff4f0fae5c2b5e3a609bc4f7d310a7f7abb342808fb892acf3b183e429cca8b0f3a72641bf604977ad
7
+ data.tar.gz: ef356cde4063ee9b2d7bd5f1e8fb00e5f8e37898ef9b6a68426bde2d3d8e9cb92e74171d336a47050c5bb422bcb481be552bf4b5ddba1f9987485637189179a9
Binary file
@@ -50,7 +50,7 @@ module Processing
50
50
  end
51
51
 
52
52
  def reload_files_to_watch
53
- @files = Dir.glob(File.join(SKETCH_ROOT, '**/*.rb'))
53
+ @files = Dir.glob(File.join(SKETCH_ROOT, "**/*.{rb,glsl}"))
54
54
  end
55
55
  end
56
56
  end
@@ -1,3 +1,3 @@
1
1
  module RubyProcessing
2
- VERSION = '2.6.10'
2
+ VERSION = '2.6.11'
3
3
  end
@@ -33,7 +33,7 @@
33
33
  <key>Arguments</key>
34
34
  <string>ruby-processing/runners/run.rb <%= @main_file %></string>
35
35
  <key>JVMVersion</key>
36
- <string>1.6+</string>
36
+ <string>1.7+</string>
37
37
  <key>ClassPath</key>
38
38
  <string><%= @class_path %></string>
39
39
  <key>Properties</key>
@@ -0,0 +1,97 @@
1
+ ### Using the LibraryProxy in your sketches
2
+ In the sketch you should `load_library :library_proxy` and your library class should inherit
3
+ from LibraryProxy and implement pre(), draw() and post() methods (can be empty method if not
4
+ required). For simplicity initialize your `processing library` in the sketch `setup`.
5
+
6
+ ### Example library
7
+
8
+ ```ruby
9
+ require 'forwardable'
10
+
11
+ # A custom Array created using forwardable (that can also access the PApplet pre,
12
+ # post and draw loops by extending our new LibraryProxy class. Also has access
13
+ # to custom background(int), fill(int) and stroke(int) methods.
14
+ class CustomArray < LibraryProxy
15
+ extend Forwardable
16
+ def_delegators(:@objs, :each, :<<)
17
+ include Enumerable
18
+
19
+ attr_reader :app
20
+
21
+ # We must initialize class with the PApplet instance
22
+ def initialize(app)
23
+ @app = app
24
+ @objs = []
25
+ end
26
+
27
+ def add_object(mx, my, x, y, speed)
28
+ self << Particle.new(x.to_i, y.to_i, mx, my, Sketch::UNIT, speed, 1, 1)
29
+ end
30
+
31
+ # Access the processing post loop (gets called after draw)
32
+ def post
33
+ each do |obj|
34
+ update_x obj
35
+ next unless obj.y >= Sketch::UNIT || obj.x <= 0
36
+ obj.ydir *= -1
37
+ obj.y += obj.ydir
38
+ end
39
+ end
40
+
41
+ def update_x(obj)
42
+ obj.x += obj.speed * obj.xdir
43
+ return if (0..Sketch::UNIT).cover? obj.x
44
+ obj.xdir *= -1
45
+ obj.x += obj.xdir
46
+ obj.y += obj.ydir
47
+ end
48
+
49
+ # We need this to fulfill the contract of implementing abstract methods of
50
+ # LibraryProxy which is an alias for Java::ProcessingCore::AbstractLibrary
51
+ def pre
52
+ end
53
+
54
+ # Access the processing draw loop here, using our custom background and fill
55
+ # note: use of 'app' to access ellipse functionality as would otherwise be
56
+ # required for background and fill
57
+ def draw
58
+ background(0)
59
+ fill(255)
60
+ each do |obj|
61
+ app.ellipse(obj.mx + obj.x, obj.my + obj.y, 6, 6)
62
+ end
63
+ end
64
+ end
65
+
66
+ # The Particle object
67
+
68
+ Particle = Struct.new(:x, :y, :mx, :my, :size, :speed, :xdir, :ydir)
69
+ ```
70
+ ### Example sketch
71
+
72
+ ```ruby
73
+ # A minimalist sketch that demonstrates a possible approach to creating a custom
74
+ # array of objects using forwardable. Also demonstrates how to use LibraryProxy.
75
+
76
+ load_library :library_proxy # loads the JRubyArt LibraryProxy abstract class
77
+ require_relative 'custom_array' # loads our custom 'library' class
78
+
79
+ UNIT = 40
80
+
81
+ def setup
82
+ size 640, 360
83
+ wide_count = width / UNIT
84
+ height_count = height / UNIT
85
+ custom_array = CustomArray.new(self)
86
+ height_count.times do |i|
87
+ wide_count.times do |j|
88
+ custom_array.add_object(j * UNIT, i * UNIT, UNIT / 2, UNIT / 2, rand(0.05..0.8))
89
+ end
90
+ end
91
+ no_stroke
92
+ end
93
+
94
+ # does nothing here see custom_array.rb
95
+ def draw
96
+ end
97
+ ```
@@ -0,0 +1,10 @@
1
+ require 'rpextras'
2
+
3
+ LibraryProxy = Java::ProcessingCore::AbstractLibrary
4
+
5
+ # classes that inherit from Library are expected to implement
6
+ # the abstract methods of processing.core.AbstractLibrary
7
+ # def pre...
8
+ # def draw...
9
+ # def post...
10
+ # NOOP is fine...
@@ -0,0 +1,12 @@
1
+ require 'rpextras'
2
+
3
+ class Processing::App
4
+ include Java::ProcessingCore::VideoInterface
5
+ def captureEvent(c)
6
+ # satisfy implement abstract class
7
+ end
8
+
9
+ def movieEvent(m)
10
+ # satisfy implement abstract class
11
+ end
12
+ end
@@ -9,7 +9,7 @@ WARNING = <<-EOS
9
9
  EOS
10
10
 
11
11
  JRUBYC_VERSION = '1.7.20'
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: ruby-processing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.10
4
+ version: 2.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2015-05-06 00:00:00.000000000 Z
19
+ date: 2015-06-07 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  requirement: !ruby/object:Gem::Requirement
@@ -90,6 +90,7 @@ extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
92
  - bin/rp5
93
+ - lib/rpextras.jar
93
94
  - lib/ruby-processing.rb
94
95
  - lib/ruby-processing/app.rb
95
96
  - lib/ruby-processing/config.rb
@@ -123,9 +124,11 @@ files:
123
124
  - library/control_panel/control_panel.rb
124
125
  - library/fastmath/fastmath.rb
125
126
  - library/file_chooser/file_chooser.rb
127
+ - library/library_proxy/README.md
128
+ - library/library_proxy/library_proxy.rb
126
129
  - library/vecmath/vecmath.rb
130
+ - library/video_event/video_event.rb
127
131
  - vendors/Rakefile
128
- - lib/rpextras.jar
129
132
  homepage: http://wiki.github.com/jashkenas/ruby-processing
130
133
  licenses:
131
134
  - MIT
@@ -149,7 +152,7 @@ requirements:
149
152
  - java runtime >= 1.7+
150
153
  - processing = 2.2.1+
151
154
  rubyforge_project:
152
- rubygems_version: 2.1.9
155
+ rubygems_version: 2.4.6
153
156
  signing_key:
154
157
  specification_version: 4
155
158
  summary: Code as Art, Art as Code. Processing and Ruby are meant for each other.