picrate 0.5.0-java → 0.6.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +3 -1
- data/README.md +1 -1
- data/Rakefile +8 -6
- data/docs/_editors/geany.md +5 -4
- data/docs/_editors/vim.md +6 -0
- data/docs/_includes/head.html +1 -0
- data/docs/_libraries/control_panel.md +2 -2
- data/docs/_libraries/gl_video.md +21 -0
- data/docs/_posts/2018-05-06-getting_started.md +10 -9
- data/docs/_posts/2018-05-06-install_jruby.md +19 -2
- data/docs/_posts/2018-06-26-auto_install_picrate.md +19 -4
- data/docs/_posts/2018-11-18-building-gem.md +18 -0
- data/docs/_posts/2018-11-27-getting_started_geany.md +38 -0
- data/docs/about.md +21 -10
- data/docs/assets/android-chrome-192x192.png +0 -0
- data/docs/assets/android-chrome-512x512.png +0 -0
- data/docs/assets/favicon.ico +0 -0
- data/docs/assets/geany.png +0 -0
- data/docs/assets/jwishy_picrate.png +0 -0
- data/docs/assets/picrate.svg +251 -0
- data/docs/index.html +8 -14
- data/lib/picrate/runner.rb +6 -2
- data/lib/picrate/version.rb +1 -1
- data/library/boids/boids.rb +10 -13
- data/mvnw +234 -0
- data/picrate.gemspec +2 -1
- data/pom.rb +1 -1
- data/pom.xml +1 -1
- data/src/main/java/japplemenubar/JAppleMenuBar.java +10 -2
- data/src/main/java/monkstone/ColorUtil.java +11 -1
- data/src/main/java/monkstone/MathToolModule.java +1 -0
- data/src/main/java/monkstone/PicrateLibrary.java +1 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +1 -0
- data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
- data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleSlider.java +8 -8
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/Slider.java +3 -3
- data/src/main/java/monkstone/slider/SliderBar.java +1 -1
- data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
- data/src/main/java/monkstone/vecmath/AppRender.java +1 -0
- data/src/main/java/monkstone/vecmath/JRender.java +1 -0
- data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -0
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -0
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -0
- data/src/main/java/processing/awt/PGraphicsJava2D.java +85 -16
- data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
- data/src/main/java/processing/core/PApplet.java +18 -12
- data/src/main/java/processing/core/PShape.java +1182 -305
- data/src/main/java/processing/core/PStyle.java +1 -1
- data/src/main/java/processing/core/PSurface.java +1 -1
- data/src/main/java/processing/data/FloatDict.java +196 -54
- data/src/main/java/processing/data/FloatList.java +167 -54
- data/src/main/java/processing/data/IntDict.java +211 -56
- data/src/main/java/processing/data/IntList.java +185 -52
- data/src/main/java/processing/data/JSONArray.java +69 -20
- data/src/main/java/processing/data/JSONObject.java +53 -12
- data/src/main/java/processing/data/Sort.java +40 -10
- data/src/main/java/processing/data/StringDict.java +159 -49
- data/src/main/java/processing/data/StringList.java +147 -42
- data/src/main/java/processing/data/Table.java +778 -223
- data/src/main/java/processing/data/TableRow.java +26 -2
- data/src/main/java/processing/data/XML.java +190 -50
- data/src/main/java/processing/event/Event.java +93 -0
- data/src/main/java/processing/event/KeyEvent.java +55 -13
- data/src/main/java/processing/event/MouseEvent.java +77 -1
- data/src/main/java/processing/event/TouchEvent.java +14 -1
- data/src/main/java/processing/javafx/PGraphicsFX2D.java +8 -0
- data/src/main/java/processing/opengl/FrameBuffer.java +228 -66
- data/src/main/java/processing/opengl/LinePath.java +131 -27
- data/src/main/java/processing/opengl/LineStroker.java +30 -5
- data/src/main/java/processing/opengl/PGL.java +4066 -865
- data/src/main/java/processing/opengl/PGraphics2D.java +38 -10
- data/src/main/java/processing/opengl/PGraphics3D.java +38 -6
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +1980 -474
- data/src/main/java/processing/opengl/PJOGL.java +1460 -248
- data/src/main/java/processing/opengl/PShader.java +904 -217
- data/src/main/java/processing/opengl/PShapeOpenGL.java +1811 -487
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +278 -71
- data/src/main/java/processing/opengl/Texture.java +610 -135
- data/src/main/java/processing/opengl/VertexBuffer.java +45 -9
- 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/vendors/Rakefile +1 -1
- metadata +13 -6
- data/docs/assets/circle_collisions.png +0 -0
- data/docs/favicon.ico +0 -0
data/docs/index.html
CHANGED
@@ -1,20 +1,14 @@
|
|
1
1
|
---
|
2
2
|
layout: default
|
3
3
|
---
|
4
|
+
<head>
|
5
|
+
<link rel="icon" href="{{"assets/favicon.ico" | prepend: site.baseurl | prepend: site.url }}" type="image/x-icon" />
|
6
|
+
</head>
|
7
|
+
|
4
8
|
<section role="banner">
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
<path d="M56.161,183.028l4.452-43.162l7.904,6.584L56,185.335L56.161,183.028z M70.823,152.055l19.61,39.046l-32.951,4.116
|
9
|
-
L70.823,152.055z M92.739,195.552v0.161V195.552l0.657-0.161v0.161l93.095,3.62l-126.703,0.496L92.739,195.552z M127.997,90.604
|
10
|
-
l-30.645,34.098l-27.186,17.137l-7.743-6.584l10.874-20.435l25.872-28.842l24.711-17.297l11.371,3.138L127.997,90.604z
|
11
|
-
M90.266,182.036l-18.122-36.082l25.375-16.144L90.266,182.036z M154.693,141.181l-61.129,48.271l8.24-59.306L154.693,141.181z
|
12
|
-
M158.152,144.479l38.06,51.569l-98.532-3.795L158.152,144.479z M130.638,94.546l22.734,43.015l-51.241-11.371L130.638,94.546z
|
13
|
-
M171.004,56.332l-34.111,11.035l-6.094-1.649L171.004,56.332z M132.945,90.604l7.576-19.281l42.183,6.758L132.945,90.604z
|
14
|
-
M134.922,94.546l53.875-14.494l-30.973,57.83L134.922,94.546z M194.234,76.257l-45.146-7.897l36.082-11.706L194.234,76.257z
|
15
|
-
M200,195.391l-39.213-53.218l33.943-63.609L200,195.391z"/>
|
16
|
-
</g>
|
17
|
-
</svg>
|
9
|
+
<object type="image/svg+xml" width="200" data="assets/picrate.svg">
|
10
|
+
Your browser does not support SVG
|
11
|
+
</object>
|
18
12
|
</section>
|
19
13
|
|
20
14
|
<div class="home">
|
@@ -35,4 +29,4 @@ layout: default
|
|
35
29
|
|
36
30
|
<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | prepend: site.github.url }}">via RSS</a></p>
|
37
31
|
|
38
|
-
</div>
|
32
|
+
</div>
|
data/lib/picrate/runner.rb
CHANGED
@@ -67,8 +67,12 @@ module Processing
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def show_version
|
70
|
-
|
71
|
-
|
70
|
+
require 'erb'
|
71
|
+
template = ERB.new <<-EOF
|
72
|
+
PiCrate version <%= PiCrate::VERSION %>
|
73
|
+
JRuby version <%= JRUBY_VERSION %>
|
74
|
+
EOF
|
75
|
+
puts template.result(binding)
|
72
76
|
end
|
73
77
|
|
74
78
|
def install(library)
|
data/lib/picrate/version.rb
CHANGED
data/library/boids/boids.rb
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
# Boids -- after Tom de Smedt.
|
3
3
|
# See his Python version: http://nodebox.net/code/index.php/Boids
|
4
4
|
# This is an example of how a pure-Ruby library can work. Original for
|
5
|
-
# ruby-processing Jeremy Ashkenas. Reworked, re-factored for
|
6
|
-
# by Martin Prout, features forwardable, keyword args,
|
5
|
+
# ruby-processing Jeremy Ashkenas. Reworked, re-factored for PiCrate
|
6
|
+
# by Martin Prout, features forwardable, keyword args, Vec2D.
|
7
7
|
class Boid
|
8
8
|
attr_reader :boids
|
9
9
|
attr_accessor :vel, :pos, :is_perching, :perch_time
|
10
10
|
def initialize(boids, pos)
|
11
11
|
@boids, @flock = boids, boids
|
12
12
|
@pos = pos
|
13
|
-
@vel =
|
13
|
+
@vel = Vec2D.new
|
14
14
|
@is_perching = false
|
15
15
|
@perch_time = 0.0
|
16
16
|
end
|
@@ -18,7 +18,7 @@ class Boid
|
|
18
18
|
def cohesion(d:)
|
19
19
|
# Boids gravitate towards the center of the flock,
|
20
20
|
# Which is the averaged position of the rest of the boids.
|
21
|
-
vect =
|
21
|
+
vect = Vec2D.new
|
22
22
|
@boids.each do |boid|
|
23
23
|
vect += boid.pos unless boid == self
|
24
24
|
end
|
@@ -29,7 +29,7 @@ class Boid
|
|
29
29
|
|
30
30
|
def separation(radius:)
|
31
31
|
# Boids don't like to cuddle.
|
32
|
-
vect =
|
32
|
+
vect = Vec2D.new
|
33
33
|
@boids.each do |boid|
|
34
34
|
if boid != self
|
35
35
|
dv = pos - boid.pos
|
@@ -41,7 +41,7 @@ class Boid
|
|
41
41
|
|
42
42
|
def alignment(d:)
|
43
43
|
# Boids like to fly at the speed of traffic.
|
44
|
-
vect =
|
44
|
+
vect = Vec2D.new
|
45
45
|
@boids.each do |boid|
|
46
46
|
vect += boid.vel if boid != self
|
47
47
|
end
|
@@ -52,7 +52,7 @@ class Boid
|
|
52
52
|
|
53
53
|
def limit(max:)
|
54
54
|
# Tweet, Tweet! The boid police will bust you for breaking the speed limit.
|
55
|
-
most = [vel.x.abs, vel.y.abs
|
55
|
+
most = [vel.x.abs, vel.y.abs].max
|
56
56
|
return if most < max
|
57
57
|
scale = max / most.to_f
|
58
58
|
@vel *= scale
|
@@ -84,14 +84,13 @@ class Boids
|
|
84
84
|
|
85
85
|
def self.flock(n:, x:, y:, w:, h:)
|
86
86
|
flock = Boids.new.setup(n, x, y, w, h)
|
87
|
-
flock.reset_goal(
|
87
|
+
flock.reset_goal(Vec2D.new(w / 2, h / 2, 0))
|
88
88
|
end
|
89
89
|
|
90
90
|
def setup(n, x, y, w, h)
|
91
91
|
n.times do
|
92
92
|
dx, dy = rand(w), rand(h)
|
93
|
-
|
94
|
-
self << Boid.new(self, Vec3D.new(x + dx, y + dy, z))
|
93
|
+
self << Boid.new(self, Vec2D.new(x + dx, y + dy))
|
95
94
|
end
|
96
95
|
@x, @y, @w, @h = x, y, w, h
|
97
96
|
@scattered = false
|
@@ -103,7 +102,7 @@ class Boids
|
|
103
102
|
@perch_tm = -> { 25.0 + rand(50.0) }
|
104
103
|
@has_goal = false
|
105
104
|
@flee = false
|
106
|
-
@goal =
|
105
|
+
@goal = Vec2D.new
|
107
106
|
self
|
108
107
|
end
|
109
108
|
|
@@ -152,8 +151,6 @@ class Boids
|
|
152
151
|
b.vel.y += rand(dy) if b.pos.y < @y - dy
|
153
152
|
b.vel.x -= rand(dx) if b.pos.x > @x + @w + dx
|
154
153
|
b.vel.y -= rand(dy) if b.pos.y > @y + @h + dy
|
155
|
-
b.vel.z += 10.0 if b.pos.z < 0.0
|
156
|
-
b.vel.z -= 10.0 if b.pos.z > 100.0
|
157
154
|
next unless b.pos.y > perch_y && rand < perch
|
158
155
|
b.pos.y = perch_y
|
159
156
|
b.vel.y = b.vel.y.abs * -0.2
|
data/mvnw
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# ----------------------------------------------------------------------------
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
5
|
+
# distributed with this work for additional information
|
6
|
+
# regarding copyright ownership. The ASF licenses this file
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance
|
9
|
+
# with the License. You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
14
|
+
# software distributed under the License is distributed on an
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
+
# KIND, either express or implied. See the License for the
|
17
|
+
# specific language governing permissions and limitations
|
18
|
+
# under the License.
|
19
|
+
# ----------------------------------------------------------------------------
|
20
|
+
|
21
|
+
# ----------------------------------------------------------------------------
|
22
|
+
# Maven2 Start Up Batch script
|
23
|
+
#
|
24
|
+
# Required ENV vars:
|
25
|
+
# ------------------
|
26
|
+
# JAVA_HOME - location of a JDK home dir
|
27
|
+
#
|
28
|
+
# Optional ENV vars
|
29
|
+
# -----------------
|
30
|
+
# M2_HOME - location of maven2's installed home dir
|
31
|
+
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
32
|
+
# e.g. to debug Maven itself, use
|
33
|
+
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
34
|
+
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
35
|
+
# ----------------------------------------------------------------------------
|
36
|
+
|
37
|
+
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
38
|
+
|
39
|
+
if [ -f /etc/mavenrc ] ; then
|
40
|
+
. /etc/mavenrc
|
41
|
+
fi
|
42
|
+
|
43
|
+
if [ -f "$HOME/.mavenrc" ] ; then
|
44
|
+
. "$HOME/.mavenrc"
|
45
|
+
fi
|
46
|
+
|
47
|
+
fi
|
48
|
+
|
49
|
+
# OS specific support. $var _must_ be set to either true or false.
|
50
|
+
cygwin=false;
|
51
|
+
darwin=false;
|
52
|
+
mingw=false
|
53
|
+
case "`uname`" in
|
54
|
+
CYGWIN*) cygwin=true ;;
|
55
|
+
MINGW*) mingw=true;;
|
56
|
+
Darwin*) darwin=true
|
57
|
+
#
|
58
|
+
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
59
|
+
# for the new JDKs provided by Oracle.
|
60
|
+
#
|
61
|
+
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
|
62
|
+
#
|
63
|
+
# Apple JDKs
|
64
|
+
#
|
65
|
+
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
66
|
+
fi
|
67
|
+
|
68
|
+
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
|
69
|
+
#
|
70
|
+
# Apple JDKs
|
71
|
+
#
|
72
|
+
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
73
|
+
fi
|
74
|
+
|
75
|
+
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
|
76
|
+
#
|
77
|
+
# Oracle JDKs
|
78
|
+
#
|
79
|
+
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
80
|
+
fi
|
81
|
+
|
82
|
+
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
|
83
|
+
#
|
84
|
+
# Apple JDKs
|
85
|
+
#
|
86
|
+
export JAVA_HOME=`/usr/libexec/java_home`
|
87
|
+
fi
|
88
|
+
;;
|
89
|
+
esac
|
90
|
+
|
91
|
+
if [ -z "$JAVA_HOME" ] ; then
|
92
|
+
if [ -r /etc/gentoo-release ] ; then
|
93
|
+
JAVA_HOME=`java-config --jre-home`
|
94
|
+
fi
|
95
|
+
fi
|
96
|
+
|
97
|
+
if [ -z "$M2_HOME" ] ; then
|
98
|
+
## resolve links - $0 may be a link to maven's home
|
99
|
+
PRG="$0"
|
100
|
+
|
101
|
+
# need this for relative symlinks
|
102
|
+
while [ -h "$PRG" ] ; do
|
103
|
+
ls=`ls -ld "$PRG"`
|
104
|
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
105
|
+
if expr "$link" : '/.*' > /dev/null; then
|
106
|
+
PRG="$link"
|
107
|
+
else
|
108
|
+
PRG="`dirname "$PRG"`/$link"
|
109
|
+
fi
|
110
|
+
done
|
111
|
+
|
112
|
+
saveddir=`pwd`
|
113
|
+
|
114
|
+
M2_HOME=`dirname "$PRG"`/..
|
115
|
+
|
116
|
+
# make it fully qualified
|
117
|
+
M2_HOME=`cd "$M2_HOME" && pwd`
|
118
|
+
|
119
|
+
cd "$saveddir"
|
120
|
+
# echo Using m2 at $M2_HOME
|
121
|
+
fi
|
122
|
+
|
123
|
+
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
124
|
+
if $cygwin ; then
|
125
|
+
[ -n "$M2_HOME" ] &&
|
126
|
+
M2_HOME=`cygpath --unix "$M2_HOME"`
|
127
|
+
[ -n "$JAVA_HOME" ] &&
|
128
|
+
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
129
|
+
[ -n "$CLASSPATH" ] &&
|
130
|
+
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
131
|
+
fi
|
132
|
+
|
133
|
+
# For Migwn, ensure paths are in UNIX format before anything is touched
|
134
|
+
if $mingw ; then
|
135
|
+
[ -n "$M2_HOME" ] &&
|
136
|
+
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
137
|
+
[ -n "$JAVA_HOME" ] &&
|
138
|
+
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
139
|
+
# TODO classpath?
|
140
|
+
fi
|
141
|
+
|
142
|
+
if [ -z "$JAVA_HOME" ]; then
|
143
|
+
javaExecutable="`which javac`"
|
144
|
+
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
145
|
+
# readlink(1) is not available as standard on Solaris 10.
|
146
|
+
readLink=`which readlink`
|
147
|
+
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
148
|
+
if $darwin ; then
|
149
|
+
javaHome="`dirname \"$javaExecutable\"`"
|
150
|
+
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
151
|
+
else
|
152
|
+
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
153
|
+
fi
|
154
|
+
javaHome="`dirname \"$javaExecutable\"`"
|
155
|
+
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
156
|
+
JAVA_HOME="$javaHome"
|
157
|
+
export JAVA_HOME
|
158
|
+
fi
|
159
|
+
fi
|
160
|
+
fi
|
161
|
+
|
162
|
+
if [ -z "$JAVACMD" ] ; then
|
163
|
+
if [ -n "$JAVA_HOME" ] ; then
|
164
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
165
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
166
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
167
|
+
else
|
168
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
169
|
+
fi
|
170
|
+
else
|
171
|
+
JAVACMD="`which java`"
|
172
|
+
fi
|
173
|
+
fi
|
174
|
+
|
175
|
+
if [ ! -x "$JAVACMD" ] ; then
|
176
|
+
echo "Error: JAVA_HOME is not defined correctly." >&2
|
177
|
+
echo " We cannot execute $JAVACMD" >&2
|
178
|
+
exit 1
|
179
|
+
fi
|
180
|
+
|
181
|
+
if [ -z "$JAVA_HOME" ] ; then
|
182
|
+
echo "Warning: JAVA_HOME environment variable is not set."
|
183
|
+
fi
|
184
|
+
|
185
|
+
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
186
|
+
|
187
|
+
# For Cygwin, switch paths to Windows format before running java
|
188
|
+
if $cygwin; then
|
189
|
+
[ -n "$M2_HOME" ] &&
|
190
|
+
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
191
|
+
[ -n "$JAVA_HOME" ] &&
|
192
|
+
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
193
|
+
[ -n "$CLASSPATH" ] &&
|
194
|
+
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
195
|
+
fi
|
196
|
+
|
197
|
+
# traverses directory structure from process work directory to filesystem root
|
198
|
+
# first directory with .mvn subdirectory is considered project base directory
|
199
|
+
find_maven_basedir() {
|
200
|
+
local basedir=$(pwd)
|
201
|
+
local wdir=$(pwd)
|
202
|
+
while [ "$wdir" != '/' ] ; do
|
203
|
+
if [ -d "$wdir"/.mvn ] ; then
|
204
|
+
basedir=$wdir
|
205
|
+
break
|
206
|
+
fi
|
207
|
+
wdir=$(cd "$wdir/.."; pwd)
|
208
|
+
done
|
209
|
+
echo "${basedir}"
|
210
|
+
}
|
211
|
+
|
212
|
+
# concatenates all lines of a file
|
213
|
+
concat_lines() {
|
214
|
+
if [ -f "$1" ]; then
|
215
|
+
echo "$(tr -s '\n' ' ' < "$1")"
|
216
|
+
fi
|
217
|
+
}
|
218
|
+
|
219
|
+
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
|
220
|
+
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
221
|
+
|
222
|
+
# Provide a "standardized" way to retrieve the CLI args that will
|
223
|
+
# work with both Windows and non-Windows executions.
|
224
|
+
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
225
|
+
export MAVEN_CMD_LINE_ARGS
|
226
|
+
|
227
|
+
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
228
|
+
|
229
|
+
exec "$JAVACMD" \
|
230
|
+
$MAVEN_OPTS \
|
231
|
+
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
232
|
+
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
233
|
+
${WRAPPER_LAUNCHER} $MAVEN_CMD_LINE_ARGS
|
234
|
+
|
data/picrate.gemspec
CHANGED
@@ -15,8 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
EOS
|
16
16
|
gem.summary = %q{ruby wrapper for processing-3.4 on raspberrypi and linux64}
|
17
17
|
gem.homepage = 'https://ruby-processing.github.io/PiCrate/'
|
18
|
+
gem.post_install_message = %q{Use 'picrate --install Samples' to install samples}
|
18
19
|
gem.files = `git ls-files`.split($/)
|
19
|
-
gem.files <<
|
20
|
+
gem.files << "lib/picrate-#{PiCrate::VERSION}.jar"
|
20
21
|
gem.files << 'lib/gluegen-rt.jar'
|
21
22
|
gem.files << 'lib/jogl-all.jar'
|
22
23
|
gem.files << 'lib/gluegen-rt-natives-linux-amd64.jar'
|
data/pom.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
project 'picrate', 'http://maven.apache.org' do
|
2
2
|
|
3
3
|
model_version '4.0.0'
|
4
|
-
id 'ruby-processing:picrate:0.
|
4
|
+
id 'ruby-processing:picrate:0.6.0'
|
5
5
|
packaging 'jar'
|
6
6
|
|
7
7
|
description 'An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.'
|
data/pom.xml
CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
11
11
|
<modelVersion>4.0.0</modelVersion>
|
12
12
|
<groupId>ruby-processing</groupId>
|
13
13
|
<artifactId>picrate</artifactId>
|
14
|
-
<version>0.
|
14
|
+
<version>0.6.0</version>
|
15
15
|
<name>picrate</name>
|
16
16
|
<description>An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.</description>
|
17
17
|
<url>http://maven.apache.org</url>
|
@@ -72,13 +72,21 @@ public class JAppleMenuBar {
|
|
72
72
|
// instance.setVisible(true);
|
73
73
|
// }
|
74
74
|
|
75
|
+
/**
|
76
|
+
*
|
77
|
+
*/
|
78
|
+
|
75
79
|
|
76
80
|
static public void hide() {
|
77
81
|
instance.setVisible(false, false);
|
78
82
|
}
|
79
83
|
|
80
|
-
|
81
|
-
|
84
|
+
/**
|
85
|
+
*
|
86
|
+
* @param visibility
|
87
|
+
* @param kioskMode
|
88
|
+
*/
|
89
|
+
public native void setVisible(boolean visibility, boolean kioskMode);
|
82
90
|
|
83
91
|
|
84
92
|
// public void setVisible(boolean visibility) {
|
@@ -81,6 +81,11 @@ public class ColorUtil {
|
|
81
81
|
return sb.toString();
|
82
82
|
}
|
83
83
|
|
84
|
+
/**
|
85
|
+
*
|
86
|
+
* @param p5colors
|
87
|
+
* @return array of web color as String
|
88
|
+
*/
|
84
89
|
static public String[] p5ToWeb(int[] p5colors) {
|
85
90
|
List<String> list = new ArrayList<>();
|
86
91
|
for (int p5color : p5colors) {
|
@@ -89,6 +94,11 @@ public class ColorUtil {
|
|
89
94
|
return list.toArray(new String[0]);
|
90
95
|
}
|
91
96
|
|
97
|
+
/**
|
98
|
+
*
|
99
|
+
* @param cols
|
100
|
+
* @return array of color int
|
101
|
+
*/
|
92
102
|
static public int[] shuffle(int[] cols) {
|
93
103
|
Random rgen = new Random(); // Random number generator
|
94
104
|
for (int i = 0; i < cols.length; i++) {
|
@@ -132,7 +142,7 @@ public class ColorUtil {
|
|
132
142
|
* @param hue
|
133
143
|
* @param sat
|
134
144
|
* @param brightness
|
135
|
-
* @return
|
145
|
+
* @return color int
|
136
146
|
*/
|
137
147
|
static public int hsbToRgB(double hue, double sat, double brightness) {
|
138
148
|
return java.awt.Color.HSBtoRGB((float) hue, (float) sat, (float) brightness);
|