ruby-processing 2.4.4 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rpextras.jar +0 -0
- data/lib/ruby-processing.rb +8 -6
- data/lib/ruby-processing/app.rb +54 -67
- data/lib/ruby-processing/config.rb +7 -7
- data/lib/ruby-processing/exporters/application_exporter.rb +37 -38
- data/lib/ruby-processing/exporters/base_exporter.rb +34 -37
- data/lib/ruby-processing/exporters/creator.rb +27 -25
- data/lib/ruby-processing/helper_methods.rb +18 -22
- data/lib/ruby-processing/helpers/numeric.rb +5 -6
- data/lib/ruby-processing/helpers/string.rb +11 -20
- data/lib/ruby-processing/library_loader.rb +33 -35
- data/lib/ruby-processing/runner.rb +118 -65
- data/lib/ruby-processing/runners/base.rb +21 -26
- data/lib/ruby-processing/runners/live.rb +3 -4
- data/lib/ruby-processing/runners/run.rb +1 -3
- data/lib/ruby-processing/runners/watch.rb +8 -8
- data/lib/ruby-processing/version.rb +1 -1
- data/lib/templates/application/lib/args.txt.erb +1 -1
- data/lib/templates/application/run.erb +3 -3
- data/library/control_panel/control_panel.rb +29 -29
- data/library/fastmath/fastmath.rb +3 -0
- data/library/file_chooser/file_chooser.rb +11 -13
- data/library/vecmath/vecmath.rb +6 -35
- data/samples/Rakefile +3 -1
- data/samples/configRP5/configRP5.pde +150 -0
- data/samples/contributed/Rakefile +6 -6
- data/samples/contributed/animator.rb +6 -6
- data/samples/contributed/bezier_playground.rb +29 -68
- data/samples/contributed/circle_collision.rb +6 -13
- data/samples/contributed/elegant_ball.rb +14 -17
- data/samples/contributed/empathy.rb +8 -5
- data/samples/contributed/fibonacci_sphere.rb +10 -49
- data/samples/contributed/full_screen.rb +1 -1
- data/samples/contributed/grapher.rb +10 -9
- data/samples/contributed/gravity.rb +11 -16
- data/samples/contributed/jwishy.rb +18 -20
- data/samples/contributed/quadraticvertex.rb +26 -26
- data/samples/external_library/java_processing/custom/landscape.rb +6 -4
- data/samples/external_library/java_processing/hemesh/twin_iso.rb +69 -71
- data/samples/external_library/java_processing/pbox2d/bumpy_surface_noise.rb +57 -0
- data/samples/external_library/java_processing/pbox2d/contact_test.rb +23 -0
- data/samples/external_library/java_processing/pbox2d/data/java_args.txt +2 -0
- data/samples/external_library/java_processing/pbox2d/library/custom_shape/custom_shape.rb +158 -0
- data/samples/external_library/java_processing/pbox2d/library/particle_system/particle_system.rb +212 -0
- data/samples/external_library/java_processing/pbox2d/library/surface/surface.rb +154 -0
- data/samples/external_library/java_processing/pbox2d/liquidy.rb +58 -0
- data/samples/external_library/java_processing/pbox2d/polygons.rb +58 -0
- data/samples/external_library/java_processing/toxiclibs/library/vbo/vbo.rb +52 -0
- data/samples/external_library/java_processing/toxiclibs/model_align.rb +9 -16
- data/samples/processing_app/basics/color/color_wheel.rb +1 -1
- data/samples/processing_app/basics/form/regular_polygon.rb +2 -2
- data/samples/processing_app/basics/form/rgb_cube.rb +2 -2
- data/samples/processing_app/basics/form/shape_primitives.rb +1 -1
- data/samples/processing_app/basics/form/star.rb +2 -2
- data/samples/processing_app/basics/input/clock.rb +21 -16
- data/samples/processing_app/basics/input/storing_input.rb +6 -6
- data/samples/processing_app/basics/math/additive_wave.rb +1 -1
- data/samples/processing_app/basics/math/sine.rb +2 -2
- data/samples/processing_app/basics/math/sine_cosine.rb +1 -1
- data/samples/processing_app/basics/math/sine_wave.rb +1 -1
- data/samples/processing_app/basics/objects/inheritance.rb +2 -0
- data/samples/processing_app/basics/objects/inheritance_two.rb +88 -0
- data/samples/processing_app/basics/objects/module.rb +89 -0
- data/samples/processing_app/{library/vecmath/drawolver.rb → basics/objects/module_two.rb} +1 -1
- data/samples/processing_app/basics/objects/multiple_constructors.rb +5 -0
- data/samples/processing_app/basics/objects/struct.rb +38 -0
- data/samples/processing_app/basics/structure/recursion2.rb +1 -1
- data/samples/processing_app/basics/transform/birds.rb +7 -10
- data/samples/processing_app/basics/transform/library/bird/bird.rb +3 -3
- data/samples/processing_app/basics/transform/rotate.rb +1 -1
- data/samples/processing_app/basics/transform/rotate1.rb +1 -1
- data/samples/processing_app/basics/transform/rotate_x_y.rb +1 -1
- data/samples/processing_app/demos/graphics/bezier_patch.rb +1 -38
- data/samples/processing_app/demos/graphics/trefoil.rb +50 -40
- data/samples/processing_app/demos/graphics/wiggling.rb +36 -38
- data/samples/processing_app/demos/performance/cubic_grid_retained.rb +14 -14
- data/samples/processing_app/demos/performance/esfera.rb +27 -39
- data/samples/processing_app/demos/performance/text_rendering.rb +1 -1
- data/samples/processing_app/library/fastmath/clock.rb +44 -0
- data/samples/processing_app/library/pdf/complex_3D.rb +26 -24
- data/samples/processing_app/library/vecmath/{Rakefile → arcball/Rakefile} +6 -6
- data/samples/processing_app/library/vecmath/arcball/arcball_box.rb +23 -0
- data/samples/processing_app/library/vecmath/arcball/arcball_radius.rb +23 -0
- data/samples/processing_app/library/vecmath/arcball/arcball_shape.rb +29 -0
- data/samples/processing_app/library/vecmath/{README.txt → vec2d/README.txt} +0 -0
- data/samples/processing_app/library/vecmath/vec2d/Rakefile +30 -0
- data/samples/processing_app/library/vecmath/{acceleration_with_vectors.rb → vec2d/acceleration_with_vectors.rb} +4 -5
- data/samples/processing_app/library/vecmath/{bouncing_ball.rb → vec2d/bouncing_ball.rb} +9 -15
- data/samples/processing_app/library/vecmath/{circle_collision.rb → vec2d/circle_collision.rb} +46 -51
- data/samples/processing_app/library/vecmath/{data → vec2d/data}/java_args.txt +0 -0
- data/samples/processing_app/library/vecmath/{data → vec2d/data}/sprite.png +0 -0
- data/samples/processing_app/library/vecmath/{data → vec2d/data}/texture.png +0 -0
- data/samples/processing_app/library/vecmath/{flocking.rb → vec2d/flocking.rb} +3 -6
- data/samples/processing_app/library/vecmath/{library → vec2d/library}/flock/flock.rb +47 -67
- data/samples/processing_app/library/vecmath/{library → vec2d/library}/particle/particle_system.rb +5 -5
- data/samples/processing_app/library/vecmath/vec2d/library/tile/tile.rb +85 -0
- data/samples/processing_app/library/vecmath/{morph.rb → vec2d/morph.rb} +17 -16
- data/samples/processing_app/library/vecmath/{multiple_particle_systems.rb → vec2d/multiple_particle_systems.rb} +11 -28
- data/samples/processing_app/library/vecmath/{particle_system_pshape.rb → vec2d/particle_system_pshape.rb} +4 -6
- data/samples/processing_app/library/vecmath/vec2d/penrose.rb +71 -0
- data/samples/processing_app/library/vecmath/{reflection1.rb → vec2d/reflection1.rb} +6 -6
- data/samples/processing_app/library/vecmath/{seeking_neural.rb → vec2d/seeking_neural.rb} +12 -16
- data/samples/processing_app/library/vecmath/{simple_particle_system.rb → vec2d/simple_particle_system.rb} +8 -12
- data/samples/processing_app/library/vecmath/{smoke_particle_system.rb → vec2d/smoke_particle_system.rb} +8 -13
- data/samples/processing_app/library/vecmath/{vector_math.rb → vec2d/vector_math.rb} +0 -0
- data/samples/processing_app/library/vecmath/{library/wiggler/wiggler.rb → vec2d/wiggle_pshape.rb} +28 -4
- data/samples/processing_app/library/vecmath/vec3d/Rakefile +30 -0
- data/samples/processing_app/library/vecmath/vec3d/drawolver.rb +86 -0
- data/samples/processing_app/library/vecmath/vec3d/frame_of_reference.rb +103 -0
- data/samples/processing_app/library/vecmath/{hilbert_fractal.rb → vec3d/hilbert_fractal.rb} +5 -33
- data/samples/processing_app/library/vecmath/vec3d/library/geometry/geometry.rb +3 -0
- data/samples/processing_app/library/vecmath/vec3d/library/geometry/lib/cylinder.rb +44 -0
- data/samples/processing_app/library/vecmath/vec3d/library/geometry/lib/mat4.rb +28 -0
- data/samples/processing_app/library/vecmath/vec3d/library/geometry/lib/plane.rb +60 -0
- data/samples/processing_app/library/vecmath/{library → vec3d/library}/hilbert/hilbert.rb +14 -17
- data/samples/processing_app/library/vecmath/{retained_menger.rb → vec3d/retained_menger.rb} +20 -55
- data/samples/processing_app/topics/advanced_data/Rakefile +6 -6
- data/samples/processing_app/topics/advanced_data/counting_words.rb +7 -7
- data/samples/processing_app/topics/advanced_data/data/data.xml +0 -15
- data/samples/processing_app/topics/advanced_data/data/struct_data.yml +5 -0
- data/samples/processing_app/topics/advanced_data/library/bubble/bubble.rb +8 -8
- data/samples/processing_app/topics/advanced_data/load_save_XML.rb +41 -42
- data/samples/processing_app/topics/advanced_data/load_save_json.rb +11 -11
- data/samples/processing_app/topics/advanced_data/load_save_struct_yaml.rb +22 -23
- data/samples/processing_app/topics/advanced_data/load_save_table.rb +12 -12
- data/samples/processing_app/topics/advanced_data/load_save_yaml.rb +10 -12
- data/samples/processing_app/topics/advanced_data/regex.rb +5 -6
- data/samples/processing_app/topics/advanced_data/threads.rb +27 -27
- data/samples/processing_app/topics/advanced_data/threads_two.rb +3 -2
- data/samples/processing_app/topics/advanced_data/word_frequency.rb +18 -16
- data/samples/processing_app/topics/advanced_data/yahoo_weather.rb +6 -5
- data/samples/processing_app/topics/animation/animated_sprite.rb +9 -7
- data/samples/processing_app/topics/animation/sequential.rb +19 -19
- data/samples/processing_app/topics/cellular_automata/library/ca/ca.rb +1 -1
- data/samples/processing_app/topics/cellular_automata/wolfram.rb +1 -1
- data/samples/processing_app/topics/create_shapes/begin_end_contour.rb +1 -1
- data/samples/processing_app/topics/create_shapes/library/wiggler/wiggler.rb +4 -4
- data/samples/processing_app/topics/create_shapes/particle_system_pshape.rb +2 -2
- data/samples/processing_app/topics/create_shapes/path_pshape.rb +1 -1
- data/samples/processing_app/topics/create_shapes/polygon_pshape_oo3.rb +1 -1
- data/samples/processing_app/topics/create_shapes/polygon_shape.rb +3 -3
- data/samples/processing_app/topics/file_io/load_file1.rb +1 -1
- data/samples/processing_app/topics/file_io/save_frames.rb +5 -5
- data/samples/processing_app/topics/file_io/save_one_image.rb +2 -2
- data/samples/processing_app/topics/file_io/tile_images.rb +1 -1
- data/samples/processing_app/topics/gui/scrollbar.rb +3 -3
- data/samples/processing_app/topics/image_processing/blending.rb +13 -13
- data/samples/processing_app/topics/image_processing/blur.rb +1 -1
- data/samples/processing_app/topics/image_processing/brightness.rb +1 -1
- data/samples/processing_app/topics/image_processing/convolution.rb +1 -1
- data/samples/processing_app/topics/image_processing/edge_detection.rb +4 -4
- data/samples/processing_app/topics/image_processing/explode.rb +1 -1
- data/samples/processing_app/topics/image_processing/extrusion.rb +1 -1
- data/samples/processing_app/topics/image_processing/histogram.rb +1 -1
- data/samples/processing_app/topics/image_processing/linear_image.rb +1 -1
- data/samples/processing_app/topics/image_processing/pixel_array.rb +1 -1
- data/samples/processing_app/topics/image_processing/zoom.rb +2 -2
- data/samples/processing_app/topics/lsystems/Rakefile +6 -6
- data/samples/processing_app/topics/lsystems/chequer.rb +4 -10
- data/samples/processing_app/topics/lsystems/csplant.rb +25 -25
- data/samples/processing_app/topics/lsystems/cstest.rb +9 -4
- data/samples/processing_app/topics/lsystems/david_tour.rb +14 -16
- data/samples/processing_app/topics/lsystems/koch.rb +8 -18
- data/samples/processing_app/topics/lsystems/library/cs_grammar/cs_grammar.rb +18 -24
- data/samples/processing_app/topics/lsystems/library/grammar/grammar.rb +7 -9
- data/samples/processing_app/topics/lsystems/library/koch/koch_fractal.rb +75 -94
- data/samples/processing_app/topics/lsystems/library/stochastic_grammar/stochastic_grammar.rb +11 -13
- data/samples/processing_app/topics/lsystems/mpeano.rb +29 -32
- data/samples/processing_app/topics/lsystems/peano.rb +19 -21
- data/samples/processing_app/topics/lsystems/penrose.rb +31 -37
- data/samples/processing_app/topics/lsystems/penrose_snowflake.rb +10 -15
- data/samples/processing_app/topics/lsystems/pentagonal.rb +20 -23
- data/samples/processing_app/topics/lsystems/snake_kolam.rb +13 -13
- data/samples/processing_app/topics/lsystems/stochastic_test.rb +25 -28
- data/samples/processing_app/topics/lsystems/three_d_tree.rb +25 -24
- data/samples/processing_app/topics/motion/bouncy_bubbles.rb +17 -17
- data/samples/processing_app/topics/motion/cubes_in_cube.rb +1 -3
- data/samples/processing_app/topics/motion/library/cube/cube.rb +2 -2
- data/samples/processing_app/topics/motion/reflection2.rb +1 -1
- data/samples/processing_app/topics/shaders/blur_filter.rb +3 -3
- data/samples/processing_app/topics/shaders/bw_shader.rb +3 -3
- data/samples/processing_app/topics/shaders/conway.rb +5 -5
- data/samples/processing_app/topics/shaders/deform.rb +5 -5
- data/samples/processing_app/topics/shaders/edge_detect.rb +3 -5
- data/samples/processing_app/topics/shaders/glossy_fish_eye.rb +15 -21
- data/samples/processing_app/topics/shaders/glsl_heightmap_noise.rb +21 -19
- data/samples/processing_app/topics/shaders/image_mask.rb +6 -6
- data/samples/processing_app/topics/shaders/landscape.rb +4 -4
- data/samples/processing_app/topics/shaders/monjori.rb +15 -15
- data/samples/processing_app/topics/shaders/nebula.rb +3 -3
- data/samples/processing_app/topics/shaders/sep_blur.rb +15 -15
- data/samples/processing_app/topics/shaders/toon_shading.rb +2 -2
- data/samples/processing_app/topics/simulate/chain.rb +16 -14
- data/samples/processing_app/topics/simulate/smoke_particle_system.rb +3 -3
- data/samples/processing_app/topics/vectors/acceleration_with_vectors.rb +3 -2
- data/samples/processing_app/topics/vectors/bouncing_ball.rb +1 -0
- data/samples/processing_app/topics/vectors/vector_math.rb +2 -1
- data/vendors/Rakefile +15 -3
- metadata +99 -86
- data/.gitignore +0 -13
- data/.travis.yml +0 -6
- data/.yardopts +0 -5
- data/CHANGELOG +0 -316
- data/CONTRIBUTING.md +0 -35
- data/Gemfile +0 -6
- data/LICENSE.md +0 -39
- data/README.md +0 -119
- data/Rakefile +0 -37
- data/bin/install_jruby_complete +0 -13
- data/lib/ruby-processing/exporters/exporters.rb +0 -7
- data/library/vecmath/lib/arcball.rb +0 -64
- data/library/vecmath/lib/quaternion.rb +0 -62
- data/library/vecmath/lib/vec.rb +0 -232
- data/ruby-processing.gemspec +0 -54
- data/samples/processing_app/library/pdf/.gitignore +0 -1
- data/samples/processing_app/library/vecmath/retained_test.rb +0 -65
- data/samples/processing_app/library/vecmath/retained_test2.rb +0 -65
- data/samples/processing_app/library/vecmath/wiggle_pshape.rb +0 -22
- data/test/README.md +0 -6
- data/test/basic.rb +0 -14
- data/test/draw_ex.rb +0 -12
- data/test/graphics.rb +0 -7
- data/test/p2d.rb +0 -14
- data/test/p3d.rb +0 -14
- data/test/rp5_test.rb +0 -86
- data/test/setup_ex.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5b8a868675fde6dc0132b818e7587a83225334c
|
4
|
+
data.tar.gz: e8df4b54e6a1cd9a20b8c0595e659540a3245f34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 452ebce774bac88364da71c0800ed75cabb3017282d97adf2a0cf71b421c121e162a145d56c92974e12eb7b82358d204454c599cd86dee2f06418320cac90144
|
7
|
+
data.tar.gz: e409850694f47b0b6acacd3f46d9fad87bfac2a2dca2a0ae238443828c14a7c5097f70157799f3a4501f6606cc9fcd6b4d6841161bada1985365996945ecf876
|
data/lib/rpextras.jar
ADDED
Binary file
|
data/lib/ruby-processing.rb
CHANGED
@@ -7,7 +7,7 @@ unless defined? RP5_ROOT
|
|
7
7
|
RP5_ROOT = File.expand_path(File.dirname(__FILE__) + "/../")
|
8
8
|
end
|
9
9
|
|
10
|
-
SKETCH_ROOT
|
10
|
+
SKETCH_ROOT ||= Dir.pwd
|
11
11
|
|
12
12
|
require 'ruby-processing/version'
|
13
13
|
require 'ruby-processing/helpers/string'
|
@@ -17,14 +17,16 @@ require 'ruby-processing/helpers/numeric'
|
|
17
17
|
module Processing
|
18
18
|
|
19
19
|
def self.exported?
|
20
|
-
@exported ||= ENV['EXPORTED'].eql?('true')
|
20
|
+
@exported ||= ENV['EXPORTED'].eql?('true')
|
21
21
|
end
|
22
22
|
|
23
|
-
# Autoload a number of constants that we may end up using.
|
23
|
+
# Autoload a number of path/constants that we may end up using.
|
24
|
+
# mri ruby does not understand ** require 'java' ** and we may otherwise call it
|
25
|
+
# from mri ruby without lazy path loading of autoload
|
26
|
+
# NB: autoload is slated for possible removal by ruby-2.2
|
27
|
+
|
24
28
|
autoload :App, 'ruby-processing/app'
|
25
29
|
autoload :Runner, 'ruby-processing/runner'
|
26
30
|
autoload :Watcher, 'ruby-processing/runners/watch'
|
27
|
-
|
28
|
-
autoload :BaseExporter, 'ruby-processing/exporters/base_exporter'
|
29
|
-
autoload :ApplicationExporter, 'ruby-processing/exporters/application_exporter'
|
31
|
+
|
30
32
|
end
|
data/lib/ruby-processing/app.rb
CHANGED
@@ -2,13 +2,12 @@
|
|
2
2
|
# This class is a thin wrapper around Processing's PApplet.
|
3
3
|
# Most of the code here is for interfacing with Swing,
|
4
4
|
# web applets, going fullscreen and so on.
|
5
|
-
|
6
5
|
require 'java'
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
require_relative '../ruby-processing/helper_methods'
|
7
|
+
require_relative '../ruby-processing/library_loader'
|
8
|
+
require_relative '../ruby-processing/config'
|
10
9
|
|
11
|
-
Dir["#{Processing::
|
10
|
+
Dir["#{Processing::RB_CONFIG["PROCESSING_ROOT"]}/core/library/\*.jar"].each { |jar| require jar }
|
12
11
|
|
13
12
|
# Include some core processing classes that we'd like to use:
|
14
13
|
%w(PApplet PConstants PFont PImage PShape PShapeOBJ PShapeSVG PStyle PGraphicsJava2D PGraphics PFont PVector PMatrix2D PMatrix3D).each do |klass|
|
@@ -16,7 +15,7 @@ Dir["#{Processing::CONFIG["PROCESSING_ROOT"]}/core/library/\*.jar"].each { |jar|
|
|
16
15
|
end
|
17
16
|
|
18
17
|
module Processing
|
19
|
-
|
18
|
+
|
20
19
|
# This is the main Ruby-Processing class, and is what you'll
|
21
20
|
# inherit from when you create a sketch. This class can call
|
22
21
|
# all of the methods available in Processing, and has two
|
@@ -27,15 +26,15 @@ module Processing
|
|
27
26
|
class App < PApplet
|
28
27
|
include Math
|
29
28
|
include HelperMethods
|
30
|
-
|
29
|
+
|
31
30
|
# Alias some methods for familiarity for Shoes coders.
|
32
31
|
#attr_accessor :frame, :title
|
33
32
|
alias_method :oval, :ellipse
|
34
33
|
alias_method :stroke_width, :stroke_weight
|
35
34
|
alias_method :rgb, :color
|
36
35
|
alias_method :gray, :color
|
37
|
-
|
38
|
-
|
36
|
+
|
37
|
+
|
39
38
|
# When certain special methods get added to the sketch, we need to let
|
40
39
|
# Processing call them by their expected Java names.
|
41
40
|
def self.method_added(method_name) #:nodoc:
|
@@ -55,13 +54,13 @@ module Processing
|
|
55
54
|
alias_method methods_to_alias[method_name], method_name
|
56
55
|
end
|
57
56
|
end
|
58
|
-
|
59
|
-
|
57
|
+
|
58
|
+
|
60
59
|
# Class methods that we should make available in the instance.
|
61
60
|
[:map, :pow, :norm, :lerp, :second, :minute, :hour, :day, :month, :year,
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
:sq, :constrain, :dist, :blend_color, :degrees, :radians, :mag, :println,
|
62
|
+
:hex, :min, :max, :abs, :binary, :ceil, :nf, :nfc, :nfp, :nfs,
|
63
|
+
:norm, :round, :trim, :unbinary, :unhex ].each do |meth|
|
65
64
|
method = <<-EOS
|
66
65
|
def #{meth}(*args)
|
67
66
|
self.class.#{meth}(*args)
|
@@ -69,49 +68,49 @@ module Processing
|
|
69
68
|
EOS
|
70
69
|
eval method
|
71
70
|
end
|
72
|
-
|
71
|
+
|
73
72
|
# Handy getters and setters on the class go here:
|
74
73
|
def self.sketch_class; @sketch_class; end
|
75
|
-
|
74
|
+
@@full_screen = false
|
76
75
|
def self.full_screen; @@full_screen = true; end
|
77
76
|
def full_screen?; @@full_screen; end
|
78
|
-
|
79
|
-
|
77
|
+
|
78
|
+
|
80
79
|
# Keep track of what inherits from the Processing::App, because we're going
|
81
80
|
# to want to instantiate one.
|
82
81
|
def self.inherited(subclass)
|
83
82
|
super(subclass)
|
84
83
|
@sketch_class = subclass
|
85
84
|
end
|
86
|
-
|
85
|
+
|
87
86
|
def self.has_slider(*args) #:nodoc:
|
88
87
|
raise "has_slider has been replaced with a nicer control_panel library. Check it out."
|
89
88
|
end
|
90
|
-
|
89
|
+
|
91
90
|
@@library_loader = LibraryLoader.new
|
92
91
|
class << self
|
93
92
|
def load_libraries(*args)
|
94
93
|
@@library_loader.load_library(*args)
|
95
94
|
end
|
96
|
-
alias :load_library :load_libraries
|
97
|
-
|
95
|
+
alias :load_library :load_libraries
|
96
|
+
|
98
97
|
def library_loaded?(library_name)
|
99
98
|
@@library_loader.library_loaded?(library_name)
|
100
99
|
end
|
101
|
-
|
100
|
+
|
102
101
|
def load_ruby_library(*args)
|
103
102
|
@@library_loader.load_ruby_library(*args)
|
104
103
|
end
|
105
|
-
|
104
|
+
|
106
105
|
def load_java_library(*args)
|
107
106
|
@@library_loader.load_java_library(*args)
|
108
107
|
end
|
109
108
|
end
|
110
|
-
|
109
|
+
|
111
110
|
def library_loaded?(library_name)
|
112
111
|
self.class.library_loaded?(library_name)
|
113
112
|
end
|
114
|
-
|
113
|
+
|
115
114
|
# When you make a new sketch, you pass in (optionally),
|
116
115
|
# a width, height, x, y, title, and whether or not you want to
|
117
116
|
# run in full-screen.
|
@@ -125,33 +124,30 @@ module Processing
|
|
125
124
|
set_sketch_path #unless Processing.online?
|
126
125
|
mix_proxy_into_inner_classes
|
127
126
|
#@started = false
|
128
|
-
|
129
|
-
java.lang.Thread.default_uncaught_exception_handler = proc do |
|
127
|
+
|
128
|
+
java.lang.Thread.default_uncaught_exception_handler = proc do |_thread_, exception|
|
130
129
|
puts(exception.class.to_s)
|
131
130
|
puts(exception.message)
|
132
131
|
puts(exception.backtrace.collect { |trace| "\t" + trace })
|
133
|
-
close
|
132
|
+
close
|
134
133
|
end
|
135
|
-
|
136
|
-
# for the list of all available args, see
|
134
|
+
|
135
|
+
# for the list of all available args, see
|
137
136
|
# http://processing.org/reference/
|
138
137
|
|
139
138
|
args = []
|
140
|
-
|
141
139
|
@width, @height = options[:width], options[:height]
|
142
|
-
|
143
|
-
if @@full_screen || options[:full_screen]
|
140
|
+
if @@full_screen || options[:full_screen]
|
144
141
|
@@full_screen = true
|
145
142
|
args << "--present"
|
146
|
-
end
|
143
|
+
end
|
147
144
|
@render_mode ||= JAVA2D
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
PApplet.run_sketch(args, self)
|
145
|
+
x = options[:x] || 0
|
146
|
+
y = options[:y] || 0
|
147
|
+
args << "--location=#{x}, #{y}"
|
148
|
+
title = options[:title] || File.basename(SKETCH_PATH).sub(/(\.rb)$/, '').titleize
|
149
|
+
args << title
|
150
|
+
PApplet.run_sketch(args, self)
|
155
151
|
#end
|
156
152
|
end
|
157
153
|
|
@@ -167,34 +163,33 @@ module Processing
|
|
167
163
|
end
|
168
164
|
end
|
169
165
|
super(*args)
|
170
|
-
end
|
171
|
-
|
166
|
+
end
|
167
|
+
|
172
168
|
# Make sure we set the size if we set it before we start the animation thread.
|
173
169
|
def start
|
174
170
|
self.size(@width, @height) if @width && @height
|
175
171
|
super()
|
176
172
|
end
|
177
|
-
|
173
|
+
|
178
174
|
# Provide a loggable string to represent this sketch.
|
179
175
|
def inspect
|
180
176
|
"#<Processing::App:#{self.class}:#{@title}>"
|
181
177
|
end
|
182
|
-
|
183
|
-
|
178
|
+
|
184
179
|
# Cleanly close and shutter a running sketch.
|
185
180
|
def close
|
186
|
-
|
187
|
-
|
188
|
-
|
181
|
+
control_panel.remove if respond_to?(:control_panel)
|
182
|
+
self.dispose
|
183
|
+
self.frame.dispose
|
189
184
|
end
|
190
|
-
|
191
|
-
|
192
|
-
private
|
193
|
-
|
185
|
+
|
186
|
+
|
187
|
+
private
|
188
|
+
|
194
189
|
# Mix the Processing::Proxy into any inner classes defined for the
|
195
190
|
# sketch, attempting to mimic the behavior of Java's inner classes.
|
196
191
|
def mix_proxy_into_inner_classes
|
197
|
-
|
192
|
+
|
198
193
|
klass = Processing::App.sketch_class
|
199
194
|
klass.constants.each do |name|
|
200
195
|
const = klass.const_get name
|
@@ -202,16 +197,13 @@ module Processing
|
|
202
197
|
const.class_eval 'include Processing::Proxy'
|
203
198
|
end
|
204
199
|
end
|
205
|
-
|
206
200
|
end # Processing::App
|
207
|
-
|
208
|
-
|
201
|
+
|
209
202
|
# This module will get automatically mixed in to any inner class of
|
210
203
|
# a Processing::App, in order to mimic Java's inner classes, which have
|
211
204
|
# unfettered access to the methods defined in the surrounding class.
|
212
205
|
module Proxy
|
213
206
|
include Math
|
214
|
-
|
215
207
|
# Generate the list of method names that we'd like to proxy for inner classes.
|
216
208
|
# Nothing camelCased, nothing __internal__, just the Processing API.
|
217
209
|
def self.desired_method_names(inner_class)
|
@@ -221,8 +213,7 @@ module Processing
|
|
221
213
|
methods = Processing::App.public_instance_methods
|
222
214
|
methods.reject {|m| unwanted.include?(m) || bad_method.match(m) || inner_class.method_defined?(m) }
|
223
215
|
end
|
224
|
-
|
225
|
-
|
216
|
+
|
226
217
|
# Proxy methods through to the sketch.
|
227
218
|
def self.proxy_methods(inner_class)
|
228
219
|
code = desired_method_names(inner_class).inject('') do |code, method|
|
@@ -238,8 +229,7 @@ module Processing
|
|
238
229
|
end
|
239
230
|
inner_class.class_eval(code)
|
240
231
|
end
|
241
|
-
|
242
|
-
|
232
|
+
|
243
233
|
# Proxy the sketch's constants on to the inner classes.
|
244
234
|
def self.proxy_constants(inner_class)
|
245
235
|
Processing::App.constants.each do |name|
|
@@ -247,14 +237,11 @@ module Processing
|
|
247
237
|
inner_class.const_set(name, Processing::App.const_get(name))
|
248
238
|
end
|
249
239
|
end
|
250
|
-
|
251
|
-
|
240
|
+
|
252
241
|
# Don't do all of the work unless we have an inner class that needs it.
|
253
242
|
def self.included(inner_class)
|
254
243
|
proxy_methods(inner_class)
|
255
244
|
proxy_constants(inner_class)
|
256
245
|
end
|
257
|
-
|
258
246
|
end # Processing::Proxy
|
259
|
-
|
260
247
|
end # Processing
|
@@ -3,15 +3,15 @@ require 'psych'
|
|
3
3
|
module Processing
|
4
4
|
|
5
5
|
if Processing.exported?
|
6
|
-
|
7
|
-
end
|
6
|
+
RB_CONFIG = { 'PROCESSING_ROOT' => RP5_ROOT, 'JRUBY' => 'false' }
|
7
|
+
end
|
8
8
|
|
9
|
-
unless defined?
|
9
|
+
unless defined? RB_CONFIG
|
10
10
|
begin
|
11
|
-
CONFIG_FILE_PATH=File.expand_path(
|
12
|
-
|
13
|
-
rescue
|
14
|
-
warn(
|
11
|
+
CONFIG_FILE_PATH=File.expand_path('~/.rp5rc')
|
12
|
+
RB_CONFIG = (Psych.load_file(CONFIG_FILE_PATH))
|
13
|
+
rescue
|
14
|
+
warn('WARNING: you need to set PROCESSING_ROOT in ~/.rp5rc')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -1,96 +1,95 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
|
3
3
|
module Processing
|
4
|
-
|
5
|
-
# A utility class to export Ruby-Processing sketches as
|
4
|
+
require_relative '../../ruby-processing/exporters/base_exporter'
|
5
|
+
# A utility class to export Ruby-Processing sketches as
|
6
6
|
# Mac/Win/Nix Applications.
|
7
7
|
class ApplicationExporter < BaseExporter
|
8
|
-
|
8
|
+
|
9
9
|
USAGE = <<-EOS
|
10
|
-
|
10
|
+
|
11
11
|
The application exporter will generate a Mac application for you.
|
12
12
|
Usage: script/application <path_to_sketch>
|
13
|
-
Example: script/applet samples/jwishy.rb
|
13
|
+
Example: script/applet samples/jwishy.rb
|
14
14
|
Probably won't work with Oracle Java on Mac
|
15
|
-
|
15
|
+
|
16
16
|
EOS
|
17
|
-
|
17
|
+
|
18
18
|
def export!(sketch)
|
19
19
|
# Check to make sure that the main file exists
|
20
20
|
@main_file_path, @main_file, @main_folder = *get_main_file(sketch)
|
21
|
-
usage(
|
22
|
-
|
21
|
+
usage(@main_file_path && File.exist?(@main_file_path))
|
22
|
+
|
23
23
|
extract_information
|
24
|
-
|
24
|
+
|
25
25
|
compute_destination_name
|
26
|
-
|
26
|
+
|
27
27
|
wipe_and_recreate_destination
|
28
|
-
|
28
|
+
|
29
29
|
copy_over_necessary_files
|
30
|
-
|
30
|
+
|
31
31
|
calculate_substitutions
|
32
|
-
|
32
|
+
|
33
33
|
create_executables
|
34
|
-
|
34
|
+
|
35
35
|
symlink_library_into_place
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def compute_destination_name
|
39
39
|
@dest = "#{@title}.app"
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
def copy_over_necessary_files
|
43
|
-
@prefix =
|
43
|
+
@prefix = 'lib'
|
44
44
|
cp_r(Dir["#{RP5_ROOT}/lib/templates/application/{*,**}"], @dest)
|
45
45
|
@necessary_files = [@main_file_path]
|
46
|
-
@necessary_files += Dir["#{
|
46
|
+
@necessary_files += Dir["#{RB_CONFIG['PROCESSING_ROOT']}/core/library/{*,**}"]
|
47
47
|
@necessary_files += Dir["#{RP5_ROOT}/lib/{*,**}"]
|
48
48
|
@necessary_files += @real_requires
|
49
|
-
NECESSARY_FOLDERS.each do |folder|
|
49
|
+
NECESSARY_FOLDERS.each do |folder|
|
50
50
|
resource_path = File.join(@main_folder, folder)
|
51
51
|
@necessary_files << resource_path if File.exist?(resource_path)
|
52
52
|
end
|
53
53
|
@necessary_files.uniq!
|
54
54
|
cp_r(@necessary_files, File.join(@dest, @prefix))
|
55
|
-
cp_r(@libraries, File.join(@dest, @prefix,
|
55
|
+
cp_r(@libraries, File.join(@dest, @prefix, 'library')) unless @libraries.empty?
|
56
56
|
# Then move the icon
|
57
|
-
potential_icon = Dir.glob(File.join(@dest, @prefix,
|
58
|
-
move(potential_icon, File.join(@dest,
|
57
|
+
potential_icon = Dir.glob(File.join(@dest, @prefix, 'data/*.icns'))[0]
|
58
|
+
move(potential_icon, File.join(@dest, 'Contents/Resources/sketch.icns'), force: true) if potential_icon
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
def calculate_substitutions
|
62
62
|
file_list = ['lib/ruby/jruby-complete.jar']
|
63
|
-
@class_path = file_list.map {|f|
|
64
|
-
@linux_class_path =
|
65
|
-
@windows_class_path =
|
63
|
+
@class_path = file_list.map { |f| '$JAVAROOT/' + f.sub(@prefix+'/', '') }.join(':')
|
64
|
+
@linux_class_path = '.:../lib/ruby/*:../lib/*:../lib/library/*'
|
65
|
+
@windows_class_path = '.;../lib/ruby/*;../lib/*;../lib/library/*'
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
def create_executables
|
69
69
|
render_erb_in_path_with_binding(@dest, binding, :delete => true)
|
70
|
-
rm Dir.glob(@dest +
|
71
|
-
runnable = @dest +
|
72
|
-
move @dest +
|
73
|
-
move @dest +
|
70
|
+
rm Dir.glob(@dest + '/**/*.java')
|
71
|
+
runnable = @dest + '/' + File.basename(@main_file, '.rb')
|
72
|
+
move @dest + '/run', runnable
|
73
|
+
move @dest + '/run.exe', "#{runnable}.exe"
|
74
74
|
chmod 0755, runnable
|
75
75
|
chmod 0755, "#{runnable}.exe"
|
76
76
|
chmod 0755, File.join(@dest, 'Contents', 'MacOS', 'JavaApplicationStub')
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
def symlink_library_into_place
|
80
|
-
cd @dest +
|
80
|
+
cd @dest + '/Contents/Resources'
|
81
81
|
# Poor ol' windows can't symlink.
|
82
82
|
# TODO...
|
83
|
-
win ||= RbConfig::CONFIG['host_os'].match(/mswin/i)
|
83
|
+
win ||= RbConfig::CONFIG['host_os'].match(/mswin/i)
|
84
84
|
win ||= RbConfig::CONFIG['host_os'].match(/windows/i)
|
85
|
-
puts "\n[warning] Applications exported from Windows won't run on Macs...\n" if win
|
85
|
+
puts "\n[warning] Applications exported from Windows won't run on Macs...\n" if win
|
86
86
|
ln_s('../../lib', 'Java') unless win
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
def usage(predicate)
|
90
90
|
return if predicate
|
91
91
|
puts USAGE
|
92
92
|
exit
|
93
93
|
end
|
94
|
-
|
95
94
|
end
|
96
95
|
end
|