propane 3.10.0-java → 3.11.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  3. data/CHANGELOG.md +2 -0
  4. data/README.md +7 -7
  5. data/lib/propane/app.rb +2 -5
  6. data/lib/propane/helper_methods.rb +6 -6
  7. data/lib/propane/version.rb +1 -1
  8. data/lib/{propane-3.10.0.jar → propane-3.11.0.jar} +0 -0
  9. data/pom.rb +6 -6
  10. data/pom.xml +6 -6
  11. data/propane.gemspec +3 -3
  12. data/src/main/java/monkstone/noise/OpenSimplex2F.java +838 -737
  13. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -13
  14. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +14 -28
  15. data/src/main/java/processing/awt/PImageAWT.java +6 -4
  16. data/src/main/java/processing/core/PApplet.java +71 -59
  17. data/src/main/java/processing/core/PImage.java +14 -14
  18. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -13
  19. data/src/main/java/processing/opengl/PShader.java +1 -6
  20. data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
  21. data/{lib/java/processing/opengl → src/main/resources}/cursors/arrow.png +0 -0
  22. data/{lib/java/processing/opengl → src/main/resources}/cursors/cross.png +0 -0
  23. data/{lib/java/processing/opengl → src/main/resources}/cursors/hand.png +0 -0
  24. data/{lib/java/processing/opengl → src/main/resources}/cursors/license.txt +0 -0
  25. data/{lib/java/processing/opengl → src/main/resources}/cursors/move.png +0 -0
  26. data/{lib/java/processing/opengl → src/main/resources}/cursors/text.png +0 -0
  27. data/{lib/java/processing/opengl → src/main/resources}/cursors/wait.png +0 -0
  28. data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorFrag.glsl +0 -0
  29. data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorVert.glsl +0 -0
  30. data/{lib/java/processing/opengl → src/main/resources}/shaders/LightFrag.glsl +0 -0
  31. data/{lib/java/processing/opengl → src/main/resources}/shaders/LightVert.glsl +0 -0
  32. data/{lib/java/processing/opengl → src/main/resources}/shaders/LineFrag.glsl +0 -0
  33. data/{lib/java/processing/opengl → src/main/resources}/shaders/LineVert.glsl +0 -0
  34. data/{lib/java/processing/opengl → src/main/resources}/shaders/MaskFrag.glsl +0 -0
  35. data/{lib/java/processing/opengl → src/main/resources}/shaders/PointFrag.glsl +0 -0
  36. data/{lib/java/processing/opengl → src/main/resources}/shaders/PointVert.glsl +0 -0
  37. data/{lib/java/processing/opengl → src/main/resources}/shaders/TexFrag.glsl +0 -0
  38. data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightFrag.glsl +0 -0
  39. data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightVert.glsl +0 -0
  40. data/{lib/java/processing/opengl → src/main/resources}/shaders/TexVert.glsl +0 -0
  41. data/test/test_helper.rb +1 -0
  42. data/vendors/Rakefile +1 -1
  43. metadata +29 -155
  44. data/lib/java/japplemenubar/JAppleMenuBar.java +0 -88
  45. data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
  46. data/lib/java/monkstone/ColorUtil.java +0 -127
  47. data/lib/java/monkstone/MathToolModule.java +0 -287
  48. data/lib/java/monkstone/PropaneLibrary.java +0 -46
  49. data/lib/java/monkstone/core/LibraryProxy.java +0 -136
  50. data/lib/java/monkstone/fastmath/DegLutTables.java +0 -111
  51. data/lib/java/monkstone/fastmath/Deglut.java +0 -71
  52. data/lib/java/monkstone/fastmath/package-info.java +0 -6
  53. data/lib/java/monkstone/filechooser/Chooser.java +0 -39
  54. data/lib/java/monkstone/noise/FastTerrain.java +0 -874
  55. data/lib/java/monkstone/noise/Noise.java +0 -90
  56. data/lib/java/monkstone/noise/NoiseGenerator.java +0 -75
  57. data/lib/java/monkstone/noise/NoiseMode.java +0 -28
  58. data/lib/java/monkstone/noise/OpenSimplex2F.java +0 -881
  59. data/lib/java/monkstone/noise/OpenSimplex2S.java +0 -1106
  60. data/lib/java/monkstone/noise/SmoothTerrain.java +0 -1099
  61. data/lib/java/monkstone/slider/CustomHorizontalSlider.java +0 -164
  62. data/lib/java/monkstone/slider/CustomVerticalSlider.java +0 -178
  63. data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +0 -145
  64. data/lib/java/monkstone/slider/SimpleSlider.java +0 -166
  65. data/lib/java/monkstone/slider/SimpleVerticalSlider.java +0 -157
  66. data/lib/java/monkstone/slider/Slider.java +0 -61
  67. data/lib/java/monkstone/slider/SliderBar.java +0 -245
  68. data/lib/java/monkstone/slider/SliderGroup.java +0 -56
  69. data/lib/java/monkstone/slider/WheelHandler.java +0 -35
  70. data/lib/java/monkstone/vecmath/GfxRender.java +0 -86
  71. data/lib/java/monkstone/vecmath/JRender.java +0 -56
  72. data/lib/java/monkstone/vecmath/ShapeRender.java +0 -87
  73. data/lib/java/monkstone/vecmath/package-info.java +0 -20
  74. data/lib/java/monkstone/vecmath/vec2/Vec2.java +0 -802
  75. data/lib/java/monkstone/vecmath/vec2/package-info.java +0 -6
  76. data/lib/java/monkstone/vecmath/vec3/Vec3.java +0 -727
  77. data/lib/java/monkstone/vecmath/vec3/package-info.java +0 -6
  78. data/lib/java/monkstone/videoevent/CaptureEvent.java +0 -27
  79. data/lib/java/monkstone/videoevent/MovieEvent.java +0 -32
  80. data/lib/java/monkstone/videoevent/package-info.java +0 -20
  81. data/lib/java/processing/awt/PGraphicsJava2D.java +0 -3040
  82. data/lib/java/processing/awt/PImageAWT.java +0 -377
  83. data/lib/java/processing/awt/PShapeJava2D.java +0 -387
  84. data/lib/java/processing/awt/PSurfaceAWT.java +0 -1581
  85. data/lib/java/processing/awt/ShimAWT.java +0 -581
  86. data/lib/java/processing/core/PApplet.java +0 -15156
  87. data/lib/java/processing/core/PConstants.java +0 -523
  88. data/lib/java/processing/core/PFont.java +0 -1126
  89. data/lib/java/processing/core/PGraphics.java +0 -8600
  90. data/lib/java/processing/core/PImage.java +0 -3377
  91. data/lib/java/processing/core/PMatrix.java +0 -208
  92. data/lib/java/processing/core/PMatrix2D.java +0 -562
  93. data/lib/java/processing/core/PMatrix3D.java +0 -890
  94. data/lib/java/processing/core/PShape.java +0 -3561
  95. data/lib/java/processing/core/PShapeOBJ.java +0 -483
  96. data/lib/java/processing/core/PShapeSVG.java +0 -2016
  97. data/lib/java/processing/core/PStyle.java +0 -63
  98. data/lib/java/processing/core/PSurface.java +0 -198
  99. data/lib/java/processing/core/PSurfaceNone.java +0 -431
  100. data/lib/java/processing/core/PVector.java +0 -1066
  101. data/lib/java/processing/core/ThinkDifferent.java +0 -115
  102. data/lib/java/processing/data/DoubleDict.java +0 -850
  103. data/lib/java/processing/data/DoubleList.java +0 -928
  104. data/lib/java/processing/data/FloatDict.java +0 -847
  105. data/lib/java/processing/data/FloatList.java +0 -936
  106. data/lib/java/processing/data/IntDict.java +0 -807
  107. data/lib/java/processing/data/IntList.java +0 -936
  108. data/lib/java/processing/data/JSONArray.java +0 -1260
  109. data/lib/java/processing/data/JSONObject.java +0 -2282
  110. data/lib/java/processing/data/JSONTokener.java +0 -435
  111. data/lib/java/processing/data/LongDict.java +0 -802
  112. data/lib/java/processing/data/LongList.java +0 -937
  113. data/lib/java/processing/data/Sort.java +0 -46
  114. data/lib/java/processing/data/StringDict.java +0 -613
  115. data/lib/java/processing/data/StringList.java +0 -800
  116. data/lib/java/processing/data/Table.java +0 -4936
  117. data/lib/java/processing/data/TableRow.java +0 -198
  118. data/lib/java/processing/data/XML.java +0 -1156
  119. data/lib/java/processing/dxf/RawDXF.java +0 -404
  120. data/lib/java/processing/event/Event.java +0 -125
  121. data/lib/java/processing/event/KeyEvent.java +0 -70
  122. data/lib/java/processing/event/MouseEvent.java +0 -114
  123. data/lib/java/processing/event/TouchEvent.java +0 -57
  124. data/lib/java/processing/javafx/PGraphicsFX2D.java +0 -32
  125. data/lib/java/processing/javafx/PSurfaceFX.java +0 -173
  126. data/lib/java/processing/net/Client.java +0 -744
  127. data/lib/java/processing/net/Server.java +0 -388
  128. data/lib/java/processing/opengl/FontTexture.java +0 -378
  129. data/lib/java/processing/opengl/FrameBuffer.java +0 -513
  130. data/lib/java/processing/opengl/LinePath.java +0 -627
  131. data/lib/java/processing/opengl/LineStroker.java +0 -681
  132. data/lib/java/processing/opengl/PGL.java +0 -3483
  133. data/lib/java/processing/opengl/PGraphics2D.java +0 -615
  134. data/lib/java/processing/opengl/PGraphics3D.java +0 -281
  135. data/lib/java/processing/opengl/PGraphicsOpenGL.java +0 -13753
  136. data/lib/java/processing/opengl/PJOGL.java +0 -2008
  137. data/lib/java/processing/opengl/PShader.java +0 -1484
  138. data/lib/java/processing/opengl/PShapeOpenGL.java +0 -5269
  139. data/lib/java/processing/opengl/PSurfaceJOGL.java +0 -1385
  140. data/lib/java/processing/opengl/Texture.java +0 -1696
  141. data/lib/java/processing/opengl/VertexBuffer.java +0 -88
  142. data/lib/java/processing/pdf/PGraphicsPDF.java +0 -581
  143. data/lib/java/processing/svg/PGraphicsSVG.java +0 -378
  144. data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
  145. data/src/main/java/processing/opengl/cursors/cross.png +0 -0
  146. data/src/main/java/processing/opengl/cursors/hand.png +0 -0
  147. data/src/main/java/processing/opengl/cursors/license.txt +0 -27
  148. data/src/main/java/processing/opengl/cursors/move.png +0 -0
  149. data/src/main/java/processing/opengl/cursors/text.png +0 -0
  150. data/src/main/java/processing/opengl/cursors/wait.png +0 -0
  151. data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +0 -32
  152. data/src/main/java/processing/opengl/shaders/ColorVert.glsl +0 -34
  153. data/src/main/java/processing/opengl/shaders/LightFrag.glsl +0 -33
  154. data/src/main/java/processing/opengl/shaders/LightVert.glsl +0 -151
  155. data/src/main/java/processing/opengl/shaders/LineFrag.glsl +0 -32
  156. data/src/main/java/processing/opengl/shaders/LineVert.glsl +0 -100
  157. data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +0 -40
  158. data/src/main/java/processing/opengl/shaders/PointFrag.glsl +0 -32
  159. data/src/main/java/processing/opengl/shaders/PointVert.glsl +0 -56
  160. data/src/main/java/processing/opengl/shaders/TexFrag.glsl +0 -37
  161. data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +0 -37
  162. data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +0 -157
  163. data/src/main/java/processing/opengl/shaders/TexVert.glsl +0 -38
@@ -1,63 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2008 Ben Fry and Casey Reas
7
-
8
- This library is free software; you can redistribute it and/or
9
- modify it under the terms of the GNU Lesser General Public
10
- License as published by the Free Software Foundation; either
11
- version 2.1 of the License, or (at your option) any later version.
12
-
13
- This library is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- Lesser General Public License for more details.
17
-
18
- You should have received a copy of the GNU Lesser General
19
- Public License along with this library; if not, write to the
20
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21
- Boston, MA 02111-1307 USA
22
- */
23
-
24
- package processing.core;
25
-
26
-
27
- public class PStyle implements PConstants {
28
- public int imageMode;
29
- public int rectMode;
30
- public int ellipseMode;
31
- public int shapeMode;
32
-
33
- public int blendMode;
34
-
35
- public int colorMode;
36
- public float colorModeX;
37
- public float colorModeY;
38
- public float colorModeZ;
39
- public float colorModeA;
40
-
41
- public boolean tint;
42
- public int tintColor;
43
- public boolean fill;
44
- public int fillColor;
45
- public boolean stroke;
46
- public int strokeColor;
47
- public float strokeWeight;
48
- public int strokeCap;
49
- public int strokeJoin;
50
-
51
- // TODO these fellas are inconsistent, and may need to go elsewhere
52
- public float ambientR, ambientG, ambientB;
53
- public float specularR, specularG, specularB;
54
- public float emissiveR, emissiveG, emissiveB;
55
- public float shininess;
56
-
57
- public PFont textFont;
58
- public int textAlign;
59
- public int textAlignY;
60
- public int textMode;
61
- public float textSize;
62
- public float textLeading;
63
- }
@@ -1,198 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2014-15 The Processing Foundation
7
-
8
- This library is free software; you can redistribute it and/or
9
- modify it under the terms of the GNU Lesser General Public
10
- License as published by the Free Software Foundation, version 2.1.
11
-
12
- This library is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- Lesser General Public License for more details.
16
-
17
- You should have received a copy of the GNU Lesser General
18
- Public License along with this library; if not, write to the
19
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20
- Boston, MA 02111-1307 USA
21
- */
22
-
23
- package processing.core;
24
-
25
- import java.io.File;
26
-
27
- public interface PSurface {
28
- /**
29
- * Minimum dimensions for the window holding an applet. This varies between
30
- * platforms, Mac OS X 10.3 (confirmed with 10.7 and Java 6) can do any
31
- * height but requires at least 128 pixels width. Windows XP has another
32
- * set of limitations. And for all I know, Linux probably allows window
33
- * sizes to be negative numbers.
34
- */
35
- static public final int MIN_WINDOW_WIDTH = 128;
36
- static public final int MIN_WINDOW_HEIGHT = 128;
37
-
38
- //public int displayDensity();
39
-
40
- //public int displayDensity(int display);
41
-
42
- //
43
-
44
- // renderer that doesn't draw to the screen
45
- public void initOffscreen(PApplet sketch);
46
-
47
- // considering removal in favor of separate Component classes for appropriate renderers
48
- // (i.e. for Java2D or a generic Image surface, but not PDF, debatable for GL or FX)
49
- //public Component initComponent(PApplet sketch);
50
-
51
- //public Frame initFrame(PApplet sketch, Color backgroundColor,
52
- // public void initFrame(PApplet sketch, int backgroundColor,
53
- // int deviceIndex, boolean fullScreen, boolean spanDisplays);
54
- public void initFrame(PApplet sketch);
55
-
56
- //
57
-
58
- public PImage loadImage(String path, Object... args);
59
-
60
- //
61
-
62
- public void selectInput(String prompt, String callback,
63
- File file, Object callbackObject);
64
-
65
- public void selectOutput(String prompt, String callback,
66
- File file, Object callbackObject);
67
-
68
- public void selectFolder(String prompt, String callback,
69
- File file, Object callbackObject);
70
-
71
- //
72
-
73
- /**
74
- * Get the native window object associated with this drawing surface.For Java2D, this will be an AWT Frame object.
75
- * For OpenGL, the window.
76
- The data returned here is subject to the whims of the renderer,
77
- and using this method means you're willing to deal with underlying
78
- implementation changes and that you won't throw a fit like a toddler
79
- if your code breaks sometime in the future.
80
- * @return
81
- */
82
- public Object getNative();
83
-
84
- //
85
-
86
- // Just call these on an AWT Frame object stored in PApplet.
87
- // Silly, but prevents a lot of rewrite and extra methods for little benefit.
88
- // However, maybe prevents us from having to document the 'frame' variable?
89
-
90
- /** Set the window (and dock, or whatever necessary) title.
91
- * @param title */
92
- public void setTitle(String title);
93
-
94
- /** Show or hide the window.
95
- * @param visible */
96
- public void setVisible(boolean visible);
97
-
98
- /** Set true if we want to resize things (default is not resizable)
99
- * @param resizable */
100
- public void setResizable(boolean resizable);
101
-
102
- /** Dumb name, but inherited from Frame and no better ideas.
103
- * @param always */
104
- public void setAlwaysOnTop(boolean always);
105
-
106
- public void setIcon(PImage icon);
107
-
108
- //
109
-
110
- // public void placeWindow(int[] location);
111
-
112
- public void placeWindow(int[] location, int[] editorLocation);
113
-
114
- //public void placeFullScreen(boolean hideStop);
115
- public void placePresent(int stopColor);
116
-
117
- // Sketch is running from the PDE, set up messaging back to the PDE
118
- public void setupExternalMessages();
119
-
120
- //
121
-
122
- // sets displayWidth/Height inside PApplet
123
- //public void checkDisplaySize();
124
-
125
- public void setLocation(int x, int y);
126
-
127
- public void setSize(int width, int height);
128
-
129
- // /**
130
- // * Called by {@link PApplet#createGraphics} to initialize the
131
- // * {@link PGraphics#image} object with an image that's compatible with this
132
- // * drawing surface/display/hardware.
133
- // * @param gr PGraphics object whose image will be set
134
- // * @param wide
135
- // * @param high
136
- // */
137
- // create pixel buffer (pulled out for offscreen graphics)
138
- //public void initImage(PGraphics gr, int wide, int high);
139
- // create pixel buffer, called from allocate() to produce a compatible image for rendering efficiently
140
- // public void initImage(PGraphics gr);
141
-
142
- //public Component getComponent();
143
-
144
- // /**
145
- // * Sometimes smoothing must be set at the drawing surface level
146
- // * not just inside the renderer itself.
147
- // */
148
- // public void setSmooth(int level);
149
-
150
- public void setFrameRate(float fps);
151
-
152
- // // called on the first frame so that the now-visible drawing surface can
153
- // // receive key and mouse events
154
- // public void requestFocus();
155
-
156
- // // finish rendering to the screen (called by PApplet)
157
- // public void blit();
158
-
159
- //
160
-
161
- public void setCursor(int kind);
162
-
163
- public void setCursor(PImage image, int hotspotX, int hotspotY);
164
-
165
- public void showCursor();
166
-
167
- public void hideCursor();
168
-
169
- //
170
-
171
- /**
172
- * @param url the link to open
173
- * @return false if unable to find a viable way to open
174
- */
175
- public boolean openLink(String url);
176
-
177
- //
178
-
179
- /** Start the animation thread */
180
- public void startThread();
181
-
182
- /**
183
- * On the next trip through the animation thread, things should go sleepy-bye.
184
- * Does not pause the thread immediately because that needs to happen on the
185
- * animation thread itself, so fires on the next trip through draw().
186
- */
187
- public void pauseThread();
188
-
189
- public void resumeThread();
190
-
191
- /**
192
- * Stop the animation thread (set it null)
193
- * @return false if already stopped
194
- */
195
- public boolean stopThread();
196
-
197
- public boolean isStopped();
198
- }
@@ -1,431 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2015 The Processing Foundation
7
-
8
- This library is free software; you can redistribute it and/or
9
- modify it under the terms of the GNU Lesser General Public
10
- License as published by the Free Software Foundation, version 2.1.
11
-
12
- This library is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- Lesser General Public License for more details.
16
-
17
- You should have received a copy of the GNU Lesser General
18
- Public License along with this library; if not, write to the
19
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20
- Boston, MA 02111-1307 USA
21
- */
22
-
23
- package processing.core;
24
-
25
- import java.io.File;
26
-
27
- import processing.awt.ShimAWT;
28
-
29
- /**
30
- * Surface that's not really visible. Used for PDF and friends, or as a base
31
- * class for other drawing surfaces. It includes the standard rendering loop.
32
- */
33
- public class PSurfaceNone implements PSurface {
34
- protected PApplet sketch;
35
- protected PGraphics graphics;
36
-
37
- protected Thread thread;
38
- protected boolean paused;
39
- protected Object pauseObject = new Object();
40
-
41
- protected float frameRateTarget = 60;
42
- protected long frameRatePeriod = 1000000000L / 60L;
43
-
44
-
45
- public PSurfaceNone(PGraphics graphics) {
46
- this.graphics = graphics;
47
- }
48
-
49
-
50
- public int displayDensity() {
51
- return 1;
52
- }
53
-
54
-
55
- public int displayDensity(int display) {
56
- return 1;
57
- }
58
-
59
-
60
- @Override
61
- public PImage loadImage(String path, Object... args) {
62
- return ShimAWT.loadImage(sketch, path, args);
63
- }
64
-
65
-
66
- @Override
67
- public void selectInput(String prompt, String callback, File file,
68
- Object callbackObject) {
69
- }
70
-
71
-
72
- @Override
73
- public void selectOutput(String prompt, String callback, File file,
74
- Object callbackObject) {
75
- }
76
-
77
-
78
- @Override
79
- public void selectFolder(String prompt, String callback, File file,
80
- Object callbackObject) {
81
- }
82
-
83
-
84
- @Override
85
- public void initOffscreen(PApplet sketch) {
86
- this.sketch = sketch;
87
-
88
- setSize(sketch.sketchWidth(), sketch.sketchHeight());
89
- }
90
-
91
-
92
- // public Component initComponent(PApplet sketch) {
93
- // return null;
94
- // }
95
-
96
-
97
- @Override
98
- public void initFrame(PApplet sketch) {
99
- throw new IllegalStateException("initFrame() not available with " +
100
- getClass().getSimpleName());
101
- }
102
-
103
-
104
- @Override
105
- public Object getNative() {
106
- return null;
107
- }
108
-
109
-
110
- /** Set the window (and dock, or whatever necessary) title.
111
- * @param title */
112
- @Override
113
- public void setTitle(String title) {
114
- // You're in a utopian PSurface implementation where titles don't exist.
115
- }
116
-
117
-
118
- @Override
119
- public void setIcon(PImage image) {
120
- // I ain't visible, man.
121
- }
122
-
123
-
124
- /** Show or hide the window.
125
- * @param visible */
126
- @Override
127
- public void setVisible(boolean visible) {
128
- // I'm always invisible. You can't catch me.
129
- }
130
-
131
-
132
- /** Set true if we want to resize things (default is not resizable)
133
- * @param resizable */
134
- @Override
135
- public void setResizable(boolean resizable) {
136
- // I don't need size to know my worth.
137
- }
138
-
139
-
140
- @Override
141
- public void placeWindow(int[] location, int[] editorLocation) { }
142
-
143
-
144
- @Override
145
- public void placePresent(int stopColor) { }
146
-
147
-
148
- @Override
149
- public void setupExternalMessages() { }
150
-
151
-
152
- @Override
153
- public void setAlwaysOnTop(boolean always) { }
154
-
155
-
156
- //
157
-
158
-
159
- @Override
160
- public void setLocation(int x, int y) {
161
- // I'm everywhere, because I'm nowhere.
162
- }
163
-
164
-
165
- @Override
166
- public void setSize(int wide, int high) {
167
- if (PApplet.DEBUG) {
168
- //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high);
169
- new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out);
170
- }
171
-
172
- //if (wide == sketchWidth && high == sketchHeight) { // doesn't work on launch
173
- if (wide == sketch.width && high == sketch.height) {
174
- if (PApplet.DEBUG) {
175
- new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out);
176
- }
177
- return; // unchanged, don't rebuild everything
178
- }
179
-
180
- //throw new RuntimeException("implement me, see readme.md");
181
- sketch.width = wide;
182
- sketch.height = high;
183
-
184
- // set PGraphics variables for width/height/pixelWidth/pixelHeight
185
- graphics.setSize(wide, high);
186
- }
187
-
188
-
189
- // public void initImage(PGraphics graphics) {
190
- // // TODO Auto-generated method stub
191
- //
192
- // }
193
-
194
- // public Component getComponent() {
195
- // return null;
196
- // }
197
-
198
-
199
- // public void setSmooth(int level) {
200
- // // TODO Auto-generated method stub
201
- // }
202
-
203
- // void requestFocus() {
204
- // }
205
-
206
- // public void blit() {
207
- // // TODO Auto-generated method stub
208
- // }
209
-
210
- @Override
211
- public void setCursor(int kind) { }
212
-
213
- @Override
214
- public void setCursor(PImage image, int hotspotX, int hotspotY) { }
215
-
216
- @Override
217
- public void showCursor() { }
218
-
219
- @Override
220
- public void hideCursor() { }
221
-
222
-
223
- //
224
-
225
-
226
- @Override
227
- public boolean openLink(String url) {
228
- return false;
229
- }
230
-
231
-
232
- //
233
-
234
-
235
- public Thread createThread() {
236
- return new AnimationThread();
237
- }
238
-
239
-
240
- @Override
241
- public void startThread() {
242
- if (thread == null) {
243
- thread = createThread();
244
- thread.start();
245
- } else {
246
- throw new IllegalStateException("Thread already started in " +
247
- getClass().getSimpleName());
248
- }
249
- }
250
-
251
-
252
- @Override
253
- public boolean stopThread() {
254
- if (thread == null) {
255
- return false;
256
- }
257
- thread = null;
258
- return true;
259
- }
260
-
261
-
262
- @Override
263
- public boolean isStopped() {
264
- return thread == null || !thread.isAlive();
265
- }
266
-
267
-
268
- // sets a flag to pause the thread when ready
269
- @Override
270
- public void pauseThread() {
271
- PApplet.debug("PApplet.run() paused, calling object wait...");
272
- paused = true;
273
- }
274
-
275
-
276
- // halts the animation thread if the pause flag is set
277
- protected void checkPause() {
278
- if (paused) {
279
- synchronized (pauseObject) {
280
- try {
281
- pauseObject.wait();
282
- // PApplet.debug("out of wait");
283
- } catch (InterruptedException e) {
284
- // waiting for this interrupt on a start() (resume) call
285
- }
286
- }
287
- }
288
- // PApplet.debug("done with pause");
289
- }
290
-
291
-
292
- @Override
293
- public void resumeThread() {
294
- paused = false;
295
- synchronized (pauseObject) {
296
- pauseObject.notifyAll(); // wake up the animation thread
297
- }
298
- }
299
-
300
-
301
- @Override
302
- public void setFrameRate(float fps) {
303
- frameRateTarget = fps;
304
- frameRatePeriod = (long) (1000000000.0 / frameRateTarget);
305
- //g.setFrameRate(fps);
306
- }
307
-
308
-
309
- public class AnimationThread extends Thread {
310
-
311
- public AnimationThread() {
312
- super("Animation Thread");
313
- }
314
-
315
- // broken out so it can be overridden by Danger et al
316
- public void callDraw() {
317
- sketch.handleDraw();
318
- }
319
-
320
- /**
321
- * Main method for the primary animation thread.
322
- * <A HREF="http://java.sun.com/products/jfc/tsc/articles/painting/">Painting in AWT and Swing</A>
323
- */
324
- @Override
325
- public void run() { // not good to make this synchronized, locks things up
326
- long beforeTime = System.nanoTime();
327
- long overSleepTime = 0L;
328
-
329
- int noDelays = 0;
330
- // Number of frames with a delay of 0 ms before the
331
- // animation thread yields to other running threads.
332
- final int NO_DELAYS_PER_YIELD = 15;
333
-
334
- /*
335
- // If size un-initialized, might be a Canvas. Call setSize() here since
336
- // we now have a parent object that this Canvas can use as a peer.
337
- if (graphics.image == null) {
338
- // System.out.format("it's null, sketchW/H already set to %d %d%n", sketchWidth, sketchHeight);
339
- try {
340
- EventQueue.invokeAndWait(new Runnable() {
341
- public void run() {
342
- setSize(sketchWidth, sketchHeight);
343
- }
344
- });
345
- } catch (InterruptedException ie) {
346
- ie.printStackTrace();
347
- } catch (InvocationTargetException ite) {
348
- ite.printStackTrace();
349
- }
350
- // System.out.format(" but now, sketchW/H changed to %d %d%n", sketchWidth, sketchHeight);
351
- }
352
- */
353
-
354
- // un-pause the sketch and get rolling
355
- sketch.start();
356
-
357
- while ((Thread.currentThread() == thread) && !sketch.finished) {
358
- checkPause();
359
-
360
- // Don't resize the renderer from the EDT (i.e. from a ComponentEvent),
361
- // otherwise it may attempt a resize mid-render.
362
- // Dimension currentSize = canvas.getSize();
363
- // if (currentSize.width != sketchWidth || currentSize.height != sketchHeight) {
364
- // System.err.format("need to resize from %s to %d, %d%n", currentSize, sketchWidth, sketchHeight);
365
- // }
366
-
367
- // render a single frame
368
- // try {
369
- // EventQueue.invokeAndWait(new Runnable() {
370
- // public void run() {
371
- // System.out.println("calling draw, finished = " + sketch.finished);
372
- //System.out.println("calling draw, looping = " + sketch.looping + ", frameCount = " + sketch.frameCount);
373
- callDraw();
374
-
375
- // EventQueue.invokeLater(new Runnable() {
376
- // public void run() {
377
- // if (sketch.frameCount == 1) {
378
- // requestFocus();
379
- // }
380
- // }
381
- // });
382
-
383
- // }
384
- // });
385
- // } catch (InterruptedException ie) {
386
- // ie.printStackTrace();
387
- // } catch (InvocationTargetException ite) {
388
- // ite.getTargetException().printStackTrace();
389
- // }
390
-
391
- // wait for update & paint to happen before drawing next frame
392
- // this is necessary since the drawing is sometimes in a
393
- // separate thread, meaning that the next frame will start
394
- // before the update/paint is completed
395
-
396
- long afterTime = System.nanoTime();
397
- long timeDiff = afterTime - beforeTime;
398
- //System.out.println("time diff is " + timeDiff);
399
- long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
400
-
401
- if (sleepTime > 0) { // some time left in this cycle
402
- try {
403
- Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
404
- noDelays = 0; // Got some sleep, not delaying anymore
405
- } catch (InterruptedException ex) { }
406
-
407
- overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
408
-
409
- } else { // sleepTime <= 0; the frame took longer than the period
410
- overSleepTime = 0L;
411
- noDelays++;
412
-
413
- if (noDelays > NO_DELAYS_PER_YIELD) {
414
- Thread.yield(); // give another thread a chance to run
415
- noDelays = 0;
416
- }
417
- }
418
-
419
- beforeTime = System.nanoTime();
420
- }
421
-
422
- sketch.dispose(); // call to shutdown libs?
423
-
424
- // If the user called the exit() function, the window should close,
425
- // rather than the sketch just halting.
426
- if (sketch.exitCalled) {
427
- sketch.exitActual();
428
- }
429
- }
430
- }
431
- }