picrate 0.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +47 -0
- data/.mvn/extensions.xml +9 -0
- data/.mvn/wrapper/maven-wrapper.properties +1 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE.md +165 -0
- data/README.md +51 -0
- data/Rakefile +59 -0
- data/bin/picrate +8 -0
- data/docs/.gitignore +6 -0
- data/docs/_config.yml +30 -0
- data/docs/_includes/footer.html +38 -0
- data/docs/_includes/head.html +16 -0
- data/docs/_includes/header.html +27 -0
- data/docs/_includes/icon-github.html +1 -0
- data/docs/_includes/icon-github.svg +1 -0
- data/docs/_includes/icon-twitter.html +1 -0
- data/docs/_includes/icon-twitter.svg +1 -0
- data/docs/_includes/navigation.html +24 -0
- data/docs/_layouts/default.html +20 -0
- data/docs/_layouts/page.html +14 -0
- data/docs/_layouts/post.html +15 -0
- data/docs/_posts/2018-05-06-getting_started.md +8 -0
- data/docs/_posts/2018-05-06-install_jruby.md +35 -0
- data/docs/_sass/_base.scss +206 -0
- data/docs/_sass/_layout.scss +242 -0
- data/docs/_sass/_syntax-highlighting.scss +71 -0
- data/docs/about.md +10 -0
- data/docs/css/main.scss +38 -0
- data/docs/favicon.ico +0 -0
- data/docs/feed.xml +30 -0
- data/docs/index.html +38 -0
- data/lib/picrate.rb +10 -0
- data/lib/picrate/app.rb +187 -0
- data/lib/picrate/creators/sketch_class.rb +57 -0
- data/lib/picrate/creators/sketch_factory.rb +12 -0
- data/lib/picrate/creators/sketch_writer.rb +21 -0
- data/lib/picrate/helper_methods.rb +214 -0
- data/lib/picrate/helpers/numeric.rb +9 -0
- data/lib/picrate/library.rb +69 -0
- data/lib/picrate/library_loader.rb +53 -0
- data/lib/picrate/native_folder.rb +35 -0
- data/lib/picrate/native_loader.rb +27 -0
- data/lib/picrate/runner.rb +81 -0
- data/lib/picrate/version.rb +4 -0
- data/library/boids/boids.rb +209 -0
- data/library/chooser/chooser.rb +19 -0
- data/library/control_panel/control_panel.rb +182 -0
- data/library/library_proxy/README.md +99 -0
- data/library/library_proxy/library_proxy.rb +14 -0
- data/library/slider/slider.rb +42 -0
- data/library/vector_utils/vector_utils.rb +69 -0
- data/library/video_event/video_event.rb +3 -0
- data/license.txt +508 -0
- data/picrate.gemspec +35 -0
- data/pom.rb +122 -0
- data/pom.xml +214 -0
- data/src/main/java/japplemenubar/JAppleMenuBar.java +88 -0
- data/src/main/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
- data/src/main/java/monkstone/ColorUtil.java +115 -0
- data/src/main/java/monkstone/MathToolModule.java +236 -0
- data/src/main/java/monkstone/PicrateLibrary.java +47 -0
- data/src/main/java/monkstone/core/LibraryProxy.java +127 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +122 -0
- data/src/main/java/monkstone/fastmath/package-info.java +6 -0
- data/src/main/java/monkstone/filechooser/Chooser.java +48 -0
- data/src/main/java/monkstone/noise/SimplexNoise.java +465 -0
- data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +168 -0
- data/src/main/java/monkstone/slider/CustomVerticalSlider.java +182 -0
- data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +149 -0
- data/src/main/java/monkstone/slider/SimpleSlider.java +196 -0
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +163 -0
- data/src/main/java/monkstone/slider/Slider.java +67 -0
- data/src/main/java/monkstone/slider/SliderBar.java +277 -0
- data/src/main/java/monkstone/slider/SliderGroup.java +78 -0
- data/src/main/java/monkstone/slider/WheelHandler.java +35 -0
- data/src/main/java/monkstone/vecmath/AppRender.java +87 -0
- data/src/main/java/monkstone/vecmath/JRender.java +56 -0
- data/src/main/java/monkstone/vecmath/ShapeRender.java +87 -0
- data/src/main/java/monkstone/vecmath/package-info.java +20 -0
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +757 -0
- data/src/main/java/monkstone/vecmath/vec2/package-info.java +6 -0
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +727 -0
- data/src/main/java/monkstone/vecmath/vec3/package-info.java +6 -0
- data/src/main/java/monkstone/videoevent/VideoInterface.java +42 -0
- data/src/main/java/monkstone/videoevent/package-info.java +20 -0
- data/src/main/java/processing/awt/PGraphicsJava2D.java +3098 -0
- data/src/main/java/processing/awt/PShapeJava2D.java +401 -0
- data/src/main/java/processing/awt/PSurfaceAWT.java +1660 -0
- data/src/main/java/processing/core/PApplet.java +17647 -0
- data/src/main/java/processing/core/PConstants.java +1033 -0
- data/src/main/java/processing/core/PFont.java +1250 -0
- data/src/main/java/processing/core/PGraphics.java +9614 -0
- data/src/main/java/processing/core/PImage.java +3608 -0
- data/src/main/java/processing/core/PMatrix.java +347 -0
- data/src/main/java/processing/core/PMatrix2D.java +694 -0
- data/src/main/java/processing/core/PMatrix3D.java +1153 -0
- data/src/main/java/processing/core/PShape.java +4332 -0
- data/src/main/java/processing/core/PShapeOBJ.java +544 -0
- data/src/main/java/processing/core/PShapeSVG.java +1987 -0
- data/src/main/java/processing/core/PStyle.java +208 -0
- data/src/main/java/processing/core/PSurface.java +242 -0
- data/src/main/java/processing/core/PSurfaceNone.java +479 -0
- data/src/main/java/processing/core/PVector.java +1140 -0
- data/src/main/java/processing/data/FloatDict.java +829 -0
- data/src/main/java/processing/data/FloatList.java +912 -0
- data/src/main/java/processing/data/IntDict.java +796 -0
- data/src/main/java/processing/data/IntList.java +913 -0
- data/src/main/java/processing/data/JSONArray.java +1260 -0
- data/src/main/java/processing/data/JSONObject.java +2282 -0
- data/src/main/java/processing/data/JSONTokener.java +435 -0
- data/src/main/java/processing/data/Sort.java +46 -0
- data/src/main/java/processing/data/StringDict.java +601 -0
- data/src/main/java/processing/data/StringList.java +775 -0
- data/src/main/java/processing/data/Table.java +4923 -0
- data/src/main/java/processing/data/TableRow.java +198 -0
- data/src/main/java/processing/data/XML.java +1149 -0
- data/src/main/java/processing/event/Event.java +108 -0
- data/src/main/java/processing/event/KeyEvent.java +70 -0
- data/src/main/java/processing/event/MouseEvent.java +149 -0
- data/src/main/java/processing/event/TouchEvent.java +57 -0
- data/src/main/java/processing/javafx/PGraphicsFX2D.java +354 -0
- data/src/main/java/processing/opengl/FontTexture.java +379 -0
- data/src/main/java/processing/opengl/FrameBuffer.java +503 -0
- data/src/main/java/processing/opengl/LinePath.java +623 -0
- data/src/main/java/processing/opengl/LineStroker.java +685 -0
- data/src/main/java/processing/opengl/PGL.java +3366 -0
- data/src/main/java/processing/opengl/PGraphics2D.java +615 -0
- data/src/main/java/processing/opengl/PGraphics3D.java +281 -0
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13634 -0
- data/src/main/java/processing/opengl/PJOGL.java +1966 -0
- data/src/main/java/processing/opengl/PShader.java +1478 -0
- data/src/main/java/processing/opengl/PShapeOpenGL.java +5234 -0
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +1315 -0
- data/src/main/java/processing/opengl/Texture.java +1670 -0
- data/src/main/java/processing/opengl/VertexBuffer.java +88 -0
- data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
- data/src/main/java/processing/opengl/cursors/cross.png +0 -0
- data/src/main/java/processing/opengl/cursors/hand.png +0 -0
- data/src/main/java/processing/opengl/cursors/license.txt +27 -0
- data/src/main/java/processing/opengl/cursors/move.png +0 -0
- data/src/main/java/processing/opengl/cursors/text.png +0 -0
- data/src/main/java/processing/opengl/cursors/wait.png +0 -0
- data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +32 -0
- data/src/main/java/processing/opengl/shaders/ColorVert.glsl +34 -0
- data/src/main/java/processing/opengl/shaders/LightFrag.glsl +33 -0
- data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +154 -0
- data/src/main/java/processing/opengl/shaders/LightVert.glsl +151 -0
- data/src/main/java/processing/opengl/shaders/LineFrag.glsl +32 -0
- data/src/main/java/processing/opengl/shaders/LineVert.glsl +100 -0
- data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +40 -0
- data/src/main/java/processing/opengl/shaders/PointFrag.glsl +32 -0
- data/src/main/java/processing/opengl/shaders/PointVert.glsl +56 -0
- data/src/main/java/processing/opengl/shaders/TexFrag.glsl +37 -0
- data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +37 -0
- data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +160 -0
- data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +157 -0
- data/src/main/java/processing/opengl/shaders/TexVert.glsl +38 -0
- data/src/main/resources/icon/icon-1024.png +0 -0
- data/src/main/resources/icon/icon-128.png +0 -0
- data/src/main/resources/icon/icon-16.png +0 -0
- data/src/main/resources/icon/icon-256.png +0 -0
- data/src/main/resources/icon/icon-32.png +0 -0
- data/src/main/resources/icon/icon-48.png +0 -0
- data/src/main/resources/icon/icon-512.png +0 -0
- data/src/main/resources/icon/icon-64.png +0 -0
- data/src/main/resources/license.txt +508 -0
- data/test/create_test.rb +68 -0
- data/test/deglut_spec_test.rb +24 -0
- data/test/helper_methods_test.rb +58 -0
- data/test/math_tool_test.rb +75 -0
- data/test/respond_to_test.rb +215 -0
- data/test/sketches/key_event.rb +37 -0
- data/test/sketches/library/my_library/my_library.rb +32 -0
- data/test/test_helper.rb +3 -0
- data/test/vecmath_spec_test.rb +522 -0
- data/vendors/Rakefile +127 -0
- metadata +289 -0
data/test/create_test.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
require_relative '../lib/picrate/creators/sketch_class'
|
3
|
+
require_relative '../lib/picrate/creators/sketch_writer'
|
4
|
+
|
5
|
+
CLASS_SKETCH = <<~CODE
|
6
|
+
|
7
|
+
#!/usr/bin/env jruby
|
8
|
+
# frozen_string_literal: false
|
9
|
+
require 'picrate'
|
10
|
+
|
11
|
+
class FredSketch < Processing::App
|
12
|
+
def settings
|
13
|
+
size 200, 200
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup
|
17
|
+
sketch_title 'Fred Sketch'
|
18
|
+
end
|
19
|
+
|
20
|
+
def draw
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
FredSketch.new
|
26
|
+
|
27
|
+
CODE
|
28
|
+
|
29
|
+
class SketchClassTest < Minitest::Test
|
30
|
+
|
31
|
+
def setup
|
32
|
+
@basic = SketchClass.new(name: 'fred_sketch', width: 200, height: 200)
|
33
|
+
@sketch = SketchClass.new(name: 'fred_sketch', width: 200, height: 200, mode: 'p2d')
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_class
|
37
|
+
result = CLASS_SKETCH.split(/\n/, -1)
|
38
|
+
class_lines = @sketch.lines
|
39
|
+
class_lines.each_with_index do |line, i|
|
40
|
+
assert_equal result[i], line
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_indent
|
45
|
+
assert_equal ' indent', @sketch.indent('indent')
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_size
|
49
|
+
assert_equal ' size 200, 200, P2D', @sketch.size
|
50
|
+
assert_equal ' size 200, 200', @basic.size
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_sketch_title
|
54
|
+
assert_equal " sketch_title 'Fred Sketch'", @sketch.sketch_title
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_class
|
58
|
+
assert_equal "FredSketch", @sketch.sketch_class
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_class_new
|
62
|
+
assert_equal "FredSketch.new", @sketch.sketch_new
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_sketch_class
|
66
|
+
assert_equal "class FredSketch < Processing::App", @basic.class_sketch
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
require 'java'
|
3
|
+
require_relative '../lib/picrate'
|
4
|
+
|
5
|
+
Dir.chdir(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class DeglutTest < Minitest::Test
|
8
|
+
attr_reader :to_radian
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@to_radian = Math::PI / 180
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_cos_sin
|
15
|
+
(-720..720).step(1) do |deg|
|
16
|
+
sine = DegLut.sin(deg)
|
17
|
+
deg_sin = Math.sin(deg * to_radian)
|
18
|
+
assert_in_delta(sine, deg_sin, delta = 0.000001)
|
19
|
+
cosine = DegLut.cos(deg)
|
20
|
+
deg_cos = Math.cos(deg * to_radian)
|
21
|
+
assert_in_delta(cosine, deg_cos, delta = 0.000001)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'test_helper'
|
3
|
+
require 'java'
|
4
|
+
require_relative '../lib/picrate'
|
5
|
+
|
6
|
+
Java::Monkstone::PicrateLibrary.new.load(JRuby.runtime, false)
|
7
|
+
|
8
|
+
include Processing::HelperMethods
|
9
|
+
include MathTool
|
10
|
+
|
11
|
+
Dir.chdir(File.dirname(__FILE__))
|
12
|
+
|
13
|
+
class HelperMethodsTest < Minitest::Test
|
14
|
+
|
15
|
+
ARRAY = %w(albatross dog horse)
|
16
|
+
def test_hex_color
|
17
|
+
col_double = 0.5
|
18
|
+
hexcolor = 0xFFCC6600
|
19
|
+
dodgy_hexstring = '*56666'
|
20
|
+
hexstring = '#CC6600'
|
21
|
+
assert hex_color(col_double) == 0.5, 'double as a color'
|
22
|
+
assert hex_color(hexcolor) == -3381760, 'hexadecimal fixnum color'
|
23
|
+
assert hex_color(hexstring) == -3381760, 'hexadecimal string color'
|
24
|
+
assert_raises(StandardError, 'Dodgy Hexstring') do
|
25
|
+
hex_color(dodgy_hexstring)
|
26
|
+
end
|
27
|
+
assert_raises(StandardError, 'Dodgy Color Conversion') do
|
28
|
+
hex_color([])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_dist
|
33
|
+
ax, ay, bx, by = 0, 0, 1.0, 1.0
|
34
|
+
assert_in_epsilon(dist(ax, ay, bx, by), Math.sqrt(2), epsilon = 0.0001, msg = '2D distance')
|
35
|
+
by = 0.0
|
36
|
+
assert_in_epsilon(dist(ax, ay, bx, by), 1.0, epsilon = 0.0001, msg = 'when y dimension is zero')
|
37
|
+
ax, ay, bx, by = 0, 0, 0.0, 0.0
|
38
|
+
assert_in_epsilon(dist(ax, ay, bx, by), 0.0, epsilon = 0.0001, msg = 'when x and y dimension are zero')
|
39
|
+
ax, ay, bx, by = 1, 1, -2.0, -3.0
|
40
|
+
assert_in_epsilon(dist(ax, ay, bx, by), 5.0, epsilon = 0.0001, msg = 'classic triangle dimensions')
|
41
|
+
ax, ay, bx, by, cx, cy = -1, -1, 100, 2.0, 3.0, 100
|
42
|
+
assert_in_epsilon(dist(ax, ay, bx, by, cx, cy), 5.0, epsilon = 0.0001, msg = 'classic triangle dimensions')
|
43
|
+
ax, ay, bx, by, cx, cy = 0, 0, -1.0, -1.0, 0, 0
|
44
|
+
assert_in_epsilon(dist(ax, ay, bx, by, cx, cy), Math.sqrt(2), epsilon = 0.0001, msg = '2D distance')
|
45
|
+
ax, ay, bx, by, cx, cy = 0, 0, 0.0, 0.0, 0, 0
|
46
|
+
assert_in_epsilon(dist(ax, ay, bx, by, cx, cy), 0.0)
|
47
|
+
ax, ay, bx, by, cx, cy = 0, 0, 1.0, 0.0, 0, 0
|
48
|
+
assert_in_epsilon(dist(ax, ay, bx, by, cx, cy), 1.0, epsilon = 0.0001, msg = 'when x and z dimension are zero')
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_min
|
52
|
+
assert_equal(min(*ARRAY), 'albatross')
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_max
|
56
|
+
assert_equal(max(*ARRAY), 'horse')
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
require 'java'
|
3
|
+
require_relative '../lib/picrate'
|
4
|
+
|
5
|
+
Java::Monkstone::PicrateLibrary.new.load(JRuby.runtime, false)
|
6
|
+
|
7
|
+
# include Processing::HelperMethods
|
8
|
+
|
9
|
+
|
10
|
+
Dir.chdir(File.dirname(__FILE__))
|
11
|
+
|
12
|
+
class MathToolTest < Minitest::Test
|
13
|
+
include MathTool
|
14
|
+
def test_map1d
|
15
|
+
x = [0, 5, 7.5, 10]
|
16
|
+
range1 = (0..10)
|
17
|
+
range2 = (100..1)
|
18
|
+
range3 = (0..10)
|
19
|
+
range4 = (5..105)
|
20
|
+
assert_in_delta(map1d(x[0], range1, range2), 100, delta = 0.00001, msg = 'map to first')
|
21
|
+
assert_in_delta(map1d(x[1], range1, range2), 50.5, delta = 0.00001, msg = 'map to reversed intermediate')
|
22
|
+
assert_in_delta(map1d(x[2], range3, range4), 80.0, delta = 0.00001, msg = 'map to intermediate')
|
23
|
+
assert_in_delta(map1d(x[3], range1, range2), 1, delta = 0.00001, msg = 'map to last')
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_p5map # as map1d except not using range input
|
27
|
+
x = [0, 5, 7.5, 10]
|
28
|
+
range1 = (0..10)
|
29
|
+
range2 = (100..1)
|
30
|
+
range3 = (0..10)
|
31
|
+
range4 = (5..105)
|
32
|
+
assert_in_delta(p5map(x[0], range1.first, range1.last, range2.first, range2.last), 100, delta = 0.00001)
|
33
|
+
assert_in_delta(p5map(x[1], range1.first, range1.last, range2.first, range2.last), 50.5, delta = 0.00001)
|
34
|
+
assert_in_delta(p5map(x[2], range3.first, range3.last, range4.first, range4.last), 80.0, delta = 0.00001)
|
35
|
+
assert_in_delta(p5map(x[3], range1.first, range1.last, range2.first, range2.last), 1, delta = 0.00001)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_norm
|
39
|
+
x = [10, 140, 210]
|
40
|
+
start0, last0 = 30, 200
|
41
|
+
start_int, last_int = 0, 200
|
42
|
+
assert_in_delta(norm(x[0], start0, last0), -0.11764705882352941, delta = 0.00001, msg = 'unclamped map')
|
43
|
+
assert_in_delta(norm(x[1], start_int, last_int), 0.7, delta = 0.00001, msg = 'map to intermediate')
|
44
|
+
assert_in_delta(norm(x[2], start_int, last_int), 1.05, delta = 0.00001, msg = 'unclamped map')
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_norm_strict
|
48
|
+
x = [10, 140, 210]
|
49
|
+
assert_in_delta(norm_strict(x[2], x[0], x[1]), 1.0, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
50
|
+
assert_in_delta(norm_strict(x[2], x[1], x[0]), 0.0, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
51
|
+
assert_in_delta(norm_strict(x[1], x[0], x[2]), 0.65, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_lerp # behaviour is deliberately different to processing which is unclamped
|
55
|
+
x = [0.5, 0.8, 2.0]
|
56
|
+
start0, last0 = 300, 200
|
57
|
+
start_int, last_int = 0, 200
|
58
|
+
assert_in_delta(lerp(start0, last0, x[0]), 250, delta = 0.00001, msg = 'produces a intermediate value of a reversed range')
|
59
|
+
assert_in_delta(lerp(start_int, last_int, x[1]), 160, delta = 0.00001, msg = 'lerps to an intermediate value')
|
60
|
+
assert_in_delta(lerp(start_int, last_int, x[2]), 200, delta = 0.00001, msg = 'lerps to the last value of a range')
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_constrain
|
64
|
+
x_int = [15, 2_500, -2_500]
|
65
|
+
start_int, last_int = 0, 200
|
66
|
+
assert_in_delta(constrain(x_int[0], start_int, last_int), 15, delta = 0.00001)
|
67
|
+
assert_in_delta(constrain(x_int[1], start_int, last_int), 200, delta = 0.00001)
|
68
|
+
assert_in_delta(constrain(x_int[2], start_int, last_int), 0, delta = 0.00001)
|
69
|
+
xf = [15.0, 2_500.0, -2_500.0]
|
70
|
+
startf, lastf = 0, 200.0
|
71
|
+
assert_in_delta(constrain(xf[0], startf, lastf), 15.0, delta = 0.00001, msg = 'constrain to 0..200')
|
72
|
+
assert_in_delta(constrain(xf[1], startf, lastf), 200.0, delta = 0.00001, msg = 'constrain to 0..200')
|
73
|
+
assert_in_delta(constrain(xf[2], startf, lastf), 0.0, delta = 0.00001, msg = 'constrain to 0..200')
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'java'
|
3
|
+
require_relative 'test_helper'
|
4
|
+
require_relative '../lib/picrate'
|
5
|
+
|
6
|
+
METHODS = %i(
|
7
|
+
alpha
|
8
|
+
ambient
|
9
|
+
ambient_light
|
10
|
+
apply_matrix
|
11
|
+
arc
|
12
|
+
background
|
13
|
+
begin_camera
|
14
|
+
begin_contour
|
15
|
+
begin_raw
|
16
|
+
begin_record
|
17
|
+
begin_shape
|
18
|
+
bezier
|
19
|
+
bezier_detail
|
20
|
+
bezier_point
|
21
|
+
bezier_tangent
|
22
|
+
bezier_vertex
|
23
|
+
blend
|
24
|
+
blend_mode
|
25
|
+
blue
|
26
|
+
box
|
27
|
+
brightness
|
28
|
+
camera
|
29
|
+
color
|
30
|
+
color_mode
|
31
|
+
copy
|
32
|
+
create_font
|
33
|
+
create_graphics
|
34
|
+
create_image
|
35
|
+
create_input
|
36
|
+
create_output
|
37
|
+
create_reader
|
38
|
+
create_shape
|
39
|
+
create_writer
|
40
|
+
cursor
|
41
|
+
curve
|
42
|
+
curve_detail
|
43
|
+
curve_point
|
44
|
+
curve_tangent
|
45
|
+
curve_tightness
|
46
|
+
curve_vertex
|
47
|
+
directional_light
|
48
|
+
ellipse
|
49
|
+
ellipse_mode
|
50
|
+
emissive
|
51
|
+
end_camera
|
52
|
+
end_contour
|
53
|
+
end_raw
|
54
|
+
end_record
|
55
|
+
end_shape
|
56
|
+
fill
|
57
|
+
filter
|
58
|
+
focused
|
59
|
+
frame_count
|
60
|
+
frame_rate
|
61
|
+
frame_rate
|
62
|
+
frustum
|
63
|
+
get
|
64
|
+
green
|
65
|
+
height
|
66
|
+
hue
|
67
|
+
image
|
68
|
+
image_mode
|
69
|
+
key
|
70
|
+
key_code
|
71
|
+
key_pressed
|
72
|
+
key_pressed?
|
73
|
+
key_released
|
74
|
+
key_typed
|
75
|
+
lerp_color
|
76
|
+
light_falloff
|
77
|
+
light_specular
|
78
|
+
lights
|
79
|
+
line
|
80
|
+
load_bytes
|
81
|
+
load_font
|
82
|
+
load_image
|
83
|
+
load_pixels
|
84
|
+
load_shader
|
85
|
+
load_shape
|
86
|
+
load_strings
|
87
|
+
load_table
|
88
|
+
load_xml
|
89
|
+
model_x
|
90
|
+
model_y
|
91
|
+
model_z
|
92
|
+
mouse_button
|
93
|
+
mouse_clicked
|
94
|
+
mouse_dragged
|
95
|
+
mouse_moved
|
96
|
+
mouse_pressed
|
97
|
+
mouse_pressed?
|
98
|
+
mouse_released
|
99
|
+
mouse_x
|
100
|
+
mouse_y
|
101
|
+
no_cursor
|
102
|
+
no_fill
|
103
|
+
no_lights
|
104
|
+
no_smooth
|
105
|
+
no_stroke
|
106
|
+
no_tint
|
107
|
+
noise
|
108
|
+
noise_detail
|
109
|
+
noise_seed
|
110
|
+
normal
|
111
|
+
ortho
|
112
|
+
perspective
|
113
|
+
pixels
|
114
|
+
pmouse_x
|
115
|
+
pmouse_y
|
116
|
+
point
|
117
|
+
point_light
|
118
|
+
pop_matrix
|
119
|
+
print_camera
|
120
|
+
print_matrix
|
121
|
+
print_projection
|
122
|
+
push_matrix
|
123
|
+
quad
|
124
|
+
quadratic_vertex
|
125
|
+
random
|
126
|
+
random_seed
|
127
|
+
rect
|
128
|
+
rect_mode
|
129
|
+
red
|
130
|
+
request_image
|
131
|
+
reset_matrix
|
132
|
+
reset_shader
|
133
|
+
rotate
|
134
|
+
rotate_x
|
135
|
+
rotate_y
|
136
|
+
rotate_z
|
137
|
+
saturation
|
138
|
+
save
|
139
|
+
save_bytes
|
140
|
+
save_frame
|
141
|
+
save_stream
|
142
|
+
save_strings
|
143
|
+
scale
|
144
|
+
screen_x
|
145
|
+
screen_y
|
146
|
+
screen_z
|
147
|
+
select_folder
|
148
|
+
select_input
|
149
|
+
select_output
|
150
|
+
set
|
151
|
+
shader
|
152
|
+
shape
|
153
|
+
shape_mode
|
154
|
+
shear_x
|
155
|
+
shear_y
|
156
|
+
shininess
|
157
|
+
sketch_title
|
158
|
+
size
|
159
|
+
smooth
|
160
|
+
specular
|
161
|
+
sphere
|
162
|
+
sphere_detail
|
163
|
+
spot_light
|
164
|
+
stroke
|
165
|
+
stroke_cap
|
166
|
+
stroke_join
|
167
|
+
stroke_weight
|
168
|
+
text_align
|
169
|
+
text_ascent
|
170
|
+
text_descent
|
171
|
+
text_font
|
172
|
+
text_leading
|
173
|
+
text_mode
|
174
|
+
text_size
|
175
|
+
text_width
|
176
|
+
texture
|
177
|
+
texture_mode
|
178
|
+
texture_wrap
|
179
|
+
tint
|
180
|
+
translate
|
181
|
+
triangle
|
182
|
+
update_pixels
|
183
|
+
vertex
|
184
|
+
width
|
185
|
+
)
|
186
|
+
|
187
|
+
class TestSketch < Propane::App
|
188
|
+
def settings
|
189
|
+
size 100, 100
|
190
|
+
end
|
191
|
+
|
192
|
+
def setup
|
193
|
+
sketch_title 'Sketch Test'
|
194
|
+
end
|
195
|
+
|
196
|
+
def draw
|
197
|
+
exit if frame_count > 30
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
class SpecTest < Minitest::Test
|
202
|
+
def setup
|
203
|
+
@propane_sketch = TestSketch.new
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_respond
|
207
|
+
METHODS.each do |method_string|
|
208
|
+
assert_respond_to @propane_sketch, method_string
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def tear_down
|
213
|
+
@propane_sketch = nil?
|
214
|
+
end
|
215
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
require 'propane'
|
3
|
+
|
4
|
+
|
5
|
+
class CustomProxySketch < Propane::App
|
6
|
+
|
7
|
+
# A simple demonstration of vanilla processing 'reflection' methods using
|
8
|
+
# propane :library_proxy. See my_library.rb code for the guts.
|
9
|
+
load_libraries :library_proxy, :my_library
|
10
|
+
|
11
|
+
attr_reader :visible
|
12
|
+
|
13
|
+
def settings
|
14
|
+
size 300, 200
|
15
|
+
@visible = false
|
16
|
+
end
|
17
|
+
|
18
|
+
def setup
|
19
|
+
sketch_title 'Reflection Voodoo Proxy'
|
20
|
+
MyLibrary.new self
|
21
|
+
end
|
22
|
+
|
23
|
+
def hide(val)
|
24
|
+
@visible = !val
|
25
|
+
end
|
26
|
+
|
27
|
+
def draw
|
28
|
+
if visible
|
29
|
+
fill(0, 0, 200)
|
30
|
+
ellipse(170, 115, 70, 100)
|
31
|
+
else
|
32
|
+
background 0
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
CustomProxySketch.new
|