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,404 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- * RawDXF - Code to write DXF files with beginRaw/endRaw
5
- * An extension for the Processing project - http://processing.org
6
- * <p/>
7
- * This library is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- * <p/>
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
- * <p/>
17
- * You should have received a copy of the GNU Lesser General
18
- * Public License along with the Processing project; if not,
19
- * write to the Free Software Foundation, Inc., 59 Temple Place,
20
- * Suite 330, Boston, MA 02111-1307 USA
21
- */
22
-
23
- package processing.dxf;
24
-
25
- import java.io.File;
26
- import java.io.IOException;
27
- import java.io.FileWriter;
28
- import java.io.PrintWriter;
29
- import processing.core.PGraphics;
30
-
31
-
32
- /**
33
- * A simple library to write DXF files with Processing.
34
- * Because this is used with beginRaw() and endRaw(), only individual
35
- * triangles and (discontinuous) line segments will be written to the file.
36
- * <p>
37
- * Use something like a keyPressed() in PApplet to trigger it,
38
- * to avoid writing a bazillion .dxf files.
39
- * <p>
40
- * Usually, the file will be saved to the sketch's folder.
41
- * Use Sketch &rarr; Show Sketch Folder to see it from the PDE.
42
- * <p>
43
- * A simple example of how to use:
44
- * <PRE>
45
- * import processing.dxf.*;
46
- *
47
- * boolean record;
48
- *
49
- * void setup() {
50
- * size(500, 500, P3D);
51
- * }
52
- *
53
- * void keyPressed() {
54
- * // use a key press so that it doesn't make a million files
55
- * if (key == 'r') record = true;
56
- * }
57
- *
58
- * void draw() {
59
- * if (record) {
60
- * beginRaw(DXF, "output.dxf");
61
- * }
62
- *
63
- * // do all your drawing here
64
- *
65
- * if (record) {
66
- * endRaw();
67
- * record = false;
68
- * }
69
- * }
70
- * </PRE>
71
- * or to use it and be able to control the current layer:
72
- * <PRE>
73
- * import processing.dxf.*;
74
- *
75
- * boolean record;
76
- * RawDXF dxf;
77
- *
78
- * void setup() {
79
- * size(500, 500, P3D);
80
- * }
81
- *
82
- * void keyPressed() {
83
- * // use a key press so that it doesn't make a million files
84
- * if (key == 'r') record = true;
85
- * }
86
- *
87
- * void draw() {
88
- * if (record) {
89
- * dxf = (RawDXF) createGraphics(width, height, DXF, "output.dxf");
90
- * beginRaw(dxf);
91
- * }
92
- *
93
- * // do all your drawing here, and to set the layer, call:
94
- * // if (record) {
95
- * // dxf.setLayer(num);
96
- * // }
97
- * // where 'num' is an integer.
98
- * // the default is zero, or you can set it to whatever.
99
- *
100
- * if (record) {
101
- * endRaw();
102
- * record = false;
103
- * dxf = null;
104
- * }
105
- * }
106
- * </PRE>
107
- * Note that even though this class is a subclass of PGraphics, it only
108
- * implements the parts of the API that are necessary for beginRaw/endRaw.
109
- * <p>
110
- * Based on the original DXF writer from Simon Greenwold, February 2004.
111
- * Updated for Processing 0070 by Ben Fry in September 2004,
112
- * and again for Processing beta in April 2005.
113
- * Rewritten to support beginRaw/endRaw by Ben Fry in February 2006.
114
- * Updated again for inclusion as a core library in March 2006.
115
- * Constructor modifications in September 2008 as we approach 1.0.
116
- */
117
- public class RawDXF extends PGraphics {
118
-
119
- File file;
120
- PrintWriter writer;
121
- int currentLayer;
122
-
123
-
124
- public RawDXF() { }
125
-
126
- @Override
127
- public void setPath(String path) {
128
- this.path = path;
129
- if (path != null) {
130
- file = new File(path);
131
- if (!file.isAbsolute()) file = null;
132
- }
133
- if (file == null) {
134
- throw new RuntimeException("DXF export requires an absolute path " +
135
- "for the location of the output file.");
136
- }
137
- }
138
-
139
-
140
- // ..............................................................
141
-
142
-
143
- protected void allocate() {
144
- /*
145
- for (int i = 0; i < MAX_TRI_LAYERS; i++) {
146
- layerList[i] = NO_LAYER;
147
- }
148
- */
149
- setLayer(0);
150
- }
151
-
152
-
153
- @Override
154
- public void dispose() {
155
- writeFooter();
156
-
157
- writer.flush();
158
- writer.close();
159
- writer = null;
160
- }
161
-
162
- @Override
163
- public boolean displayable() {
164
- return false; // just in case someone wants to use this on its own
165
- }
166
-
167
- @Override
168
- public boolean is2D() {
169
- return false;
170
- }
171
-
172
-
173
- @Override
174
- public boolean is3D() {
175
- return true;
176
- }
177
- // ..............................................................
178
-
179
- @Override
180
- public void beginDraw() {
181
- // have to create file object here, because the name isn't yet
182
- // available in allocate()
183
- if (writer == null) {
184
- try {
185
- writer = new PrintWriter(new FileWriter(file));
186
- } catch (IOException e) {
187
- throw new RuntimeException(e); // java 1.4+
188
- }
189
- writeHeader();
190
- }
191
- }
192
-
193
- @Override
194
- public void endDraw() {
195
- writer.flush();
196
- }
197
-
198
-
199
- // ..............................................................
200
-
201
-
202
- /**
203
- * Set the current layer being used in the DXF file.The default is zero.
204
- * @param layer
205
- */
206
- public void setLayer(int layer) {
207
- currentLayer = layer;
208
- }
209
-
210
-
211
- // ..............................................................
212
-
213
-
214
- private void writeHeader() {
215
- writer.println("0");
216
- writer.println("SECTION");
217
- writer.println("2");
218
- writer.println("ENTITIES");
219
- }
220
-
221
-
222
- private void writeFooter() {
223
- writer.println("0");
224
- writer.println("ENDSEC");
225
- writer.println("0");
226
- writer.println("EOF");
227
- }
228
-
229
-
230
- /**
231
- * Write a command on one line (as a String), then start a new line
232
- * and write out a formatted float.Available for anyone who wants to
233
- insert additional commands into the DXF stream.
234
- * @param cmd
235
- * @param val
236
- */
237
- public void write(String cmd, float val) {
238
- writer.println(cmd);
239
- // Don't number format, will cause trouble on systems that aren't en-US
240
- // http://dev.processing.org/bugs/show_bug.cgi?id=495
241
- writer.println(val);
242
- }
243
-
244
-
245
- /**
246
- * Write a line to the dxf file.Available for anyone who wants to
247
- insert additional commands into the DXF stream.
248
- * @param what
249
- */
250
- public void println(String what) {
251
- writer.println(what);
252
- }
253
-
254
-
255
- protected void writeLine(int index1, int index2) {
256
- writer.println("0");
257
- writer.println("LINE");
258
-
259
- // write out the layer
260
- writer.println("8");
261
- writer.println(String.valueOf(currentLayer));
262
-
263
- write("10", vertices[index1][X]);
264
- write("20", vertices[index1][Y]);
265
- write("30", vertices[index1][Z]);
266
-
267
- write("11", vertices[index2][X]);
268
- write("21", vertices[index2][Y]);
269
- write("31", vertices[index2][Z]);
270
- }
271
-
272
-
273
- /*
274
- protected void writeLineStrip() {
275
- writeLine();
276
- // shift the last vertex to be the first vertex
277
- System.arraycopy(vertices[1], 0, vertices[0], 0, vertices[1].length);
278
- vertexCount = 1;
279
- }
280
- */
281
-
282
- protected void writeTriangle() {
283
- writer.println("0");
284
- writer.println("3DFACE");
285
-
286
- // write out the layer
287
- writer.println("8");
288
- /*
289
- if (i < MAX_TRI_LAYERS) {
290
- if (layerList[i] >= 0) {
291
- currentLayer = layerList[i];
292
- }
293
- }
294
- */
295
- writer.println(String.valueOf(currentLayer));
296
-
297
- write("10", vertices[0][X]);
298
- write("20", vertices[0][Y]);
299
- write("30", vertices[0][Z]);
300
-
301
- write("11", vertices[1][X]);
302
- write("21", vertices[1][Y]);
303
- write("31", vertices[1][Z]);
304
-
305
- write("12", vertices[2][X]);
306
- write("22", vertices[2][Y]);
307
- write("32", vertices[2][Z]);
308
-
309
- // Without adding EPSILON, Rhino kinda freaks out.
310
- // A face is actually a quad, not a triangle,
311
- // so instead kinda fudging the final point here.
312
- write("13", vertices[2][X] + EPSILON);
313
- write("23", vertices[2][Y] + EPSILON);
314
- write("33", vertices[2][Z] + EPSILON);
315
-
316
- vertexCount = 0;
317
- }
318
- // ..............................................................
319
-
320
- @Override
321
- public void beginShape(int kind) {
322
- shape = kind;
323
-
324
- if ((shape != LINES) &&
325
- (shape != TRIANGLES) &&
326
- (shape != POLYGON)) {
327
- String err =
328
- "RawDXF can only be used with beginRaw(), " +
329
- "because it only supports lines and triangles";
330
- throw new RuntimeException(err);
331
- }
332
-
333
- if ((shape == POLYGON) && fill) {
334
- throw new RuntimeException("DXF Export only supports non-filled shapes.");
335
- }
336
-
337
- vertexCount = 0;
338
- }
339
-
340
- @Override
341
- public void vertex(float x, float y) {
342
- vertex(x, y, 0);
343
- }
344
-
345
- @Override
346
- public void vertex(float x, float y, float z) {
347
- float vertex[] = vertices[vertexCount];
348
- vertex[X] = x; // note: not mx, my, mz like PGraphics3
349
- vertex[Y] = y;
350
- vertex[Z] = z;
351
-
352
- if (fill) {
353
- vertex[R] = fillR;
354
- vertex[G] = fillG;
355
- vertex[B] = fillB;
356
- vertex[A] = fillA;
357
- }
358
-
359
- if (stroke) {
360
- vertex[SR] = strokeR;
361
- vertex[SG] = strokeG;
362
- vertex[SB] = strokeB;
363
- vertex[SA] = strokeA;
364
- vertex[SW] = strokeWeight;
365
- }
366
-
367
- if (textureImage != null) { // for the future?
368
- vertex[U] = textureU;
369
- vertex[V] = textureV;
370
- }
371
- vertexCount++;
372
-
373
- if ((shape == LINES) && (vertexCount == 2)) {
374
- writeLine(0, 1);
375
- vertexCount = 0;
376
-
377
- /*
378
- } else if ((shape == LINE_STRIP) && (vertexCount == 2)) {
379
- writeLineStrip();
380
- */
381
-
382
- } else if ((shape == TRIANGLES) && (vertexCount == 3)) {
383
- writeTriangle();
384
- }
385
- }
386
-
387
- @Override
388
- public void endShape(int mode) {
389
- if (shape == POLYGON) {
390
- for (int i = 0; i < vertexCount - 1; i++) {
391
- writeLine(i, i+1);
392
- }
393
- if (mode == CLOSE) {
394
- writeLine(vertexCount - 1, 0);
395
- }
396
- }
397
- /*
398
- if ((vertexCount != 0) &&
399
- ((shape != LINE_STRIP) && (vertexCount != 1))) {
400
- System.err.println("Extra vertex boogers found.");
401
- }
402
- */
403
- }
404
- }
@@ -1,125 +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) 2012 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.event;
24
-
25
-
26
- public class Event {
27
- protected Object nativeObject;
28
-
29
- protected long millis;
30
- protected int action;
31
-
32
- // These correspond to the java.awt.Event modifiers (not to be confused with
33
- // the newer getModifiersEx), though they're not guaranteed to in the future.
34
- static public final int SHIFT = 1 << 0;
35
- static public final int CTRL = 1 << 1;
36
- static public final int META = 1 << 2;
37
- static public final int ALT = 1 << 3;
38
- protected int modifiers;
39
-
40
- // Types of events. As with all constants in Processing, brevity's preferred.
41
- static public final int KEY = 1;
42
- static public final int MOUSE = 2;
43
- static public final int TOUCH = 3;
44
- protected int flavor;
45
-
46
-
47
- public Event(Object nativeObject, long millis, int action, int modifiers) {
48
- this.nativeObject = nativeObject;
49
- this.millis = millis;
50
- this.action = action;
51
- this.modifiers = modifiers;
52
- }
53
-
54
-
55
- public int getFlavor() {
56
- return flavor;
57
- }
58
-
59
-
60
- /**
61
- * Get the platform-native event object. This might be the java.awt event
62
- * on the desktop, though if you're using OpenGL on the desktop it'll be a
63
- * NEWT event that JOGL uses. Android events are something else altogether.
64
- * Bottom line, use this only if you know what you're doing, and don't make
65
- * assumptions about the class type.
66
- */
67
- public Object getNative() {
68
- return nativeObject;
69
- }
70
-
71
-
72
- // public void setNative(Object nativeObject) {
73
- // this.nativeObject = nativeObject;
74
- // }
75
-
76
-
77
- public long getMillis() {
78
- return millis;
79
- }
80
-
81
-
82
- // public void setMillis(long millis) {
83
- // this.millis = millis;
84
- // }
85
-
86
-
87
- public int getAction() {
88
- return action;
89
- }
90
-
91
-
92
- // public void setAction(int action) {
93
- // this.action = action;
94
- // }
95
-
96
-
97
- public int getModifiers() {
98
- return modifiers;
99
- }
100
-
101
-
102
- // public void setModifiers(int modifiers) {
103
- // this.modifiers = modifiers;
104
- // }
105
-
106
-
107
- public boolean isShiftDown() {
108
- return (modifiers & SHIFT) != 0;
109
- }
110
-
111
-
112
- public boolean isControlDown() {
113
- return (modifiers & CTRL) != 0;
114
- }
115
-
116
-
117
- public boolean isMetaDown() {
118
- return (modifiers & META) != 0;
119
- }
120
-
121
-
122
- public boolean isAltDown() {
123
- return (modifiers & ALT) != 0;
124
- }
125
- }
@@ -1,70 +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) 2012 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.event;
24
-
25
-
26
- public class KeyEvent extends Event {
27
- static public final int PRESS = 1;
28
- static public final int RELEASE = 2;
29
- static public final int TYPE = 3;
30
-
31
- char key;
32
- int keyCode;
33
-
34
- boolean isAutoRepeat;
35
-
36
-
37
- public KeyEvent(Object nativeObject,
38
- long millis, int action, int modifiers,
39
- char key, int keyCode) {
40
- super(nativeObject, millis, action, modifiers);
41
- this.flavor = KEY;
42
- this.key = key;
43
- this.keyCode = keyCode;
44
- }
45
-
46
- public KeyEvent(Object nativeObject,
47
- long millis, int action, int modifiers,
48
- char key, int keyCode, boolean isAutoRepeat) {
49
- super(nativeObject, millis, action, modifiers);
50
- this.flavor = KEY;
51
- this.key = key;
52
- this.keyCode = keyCode;
53
- this.isAutoRepeat = isAutoRepeat;
54
- }
55
-
56
-
57
- public char getKey() {
58
- return key;
59
- }
60
-
61
-
62
- public int getKeyCode() {
63
- return keyCode;
64
- }
65
-
66
-
67
- public boolean isAutoRepeat() {
68
- return isAutoRepeat;
69
- }
70
- }
@@ -1,114 +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) 2012 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.event;
24
-
25
- //import processing.core.PConstants;
26
-
27
-
28
- public class MouseEvent extends Event {
29
- static public final int PRESS = 1;
30
- static public final int RELEASE = 2;
31
- static public final int CLICK = 3;
32
- static public final int DRAG = 4;
33
- static public final int MOVE = 5;
34
- static public final int ENTER = 6;
35
- static public final int EXIT = 7;
36
- static public final int WHEEL = 8;
37
-
38
- protected int x, y;
39
- protected int button;
40
- protected int count;
41
-
42
-
43
- public MouseEvent(Object nativeObject,
44
- long millis, int action, int modifiers,
45
- int x, int y, int button, int count) {
46
- super(nativeObject, millis, action, modifiers);
47
- this.flavor = MOUSE;
48
- this.x = x;
49
- this.y = y;
50
- this.button = button;
51
- this.count = count;
52
- }
53
-
54
-
55
- public int getX() {
56
- return x;
57
- }
58
-
59
-
60
- public int getY() {
61
- return y;
62
- }
63
-
64
-
65
- /** Which button was pressed, either LEFT, CENTER, or RIGHT.
66
- * @return */
67
- public int getButton() {
68
- return button;
69
- }
70
-
71
-
72
- /**
73
- * Number of clicks for mouse button events, or the number of steps (positive
74
- * or negative depending on direction) for a mouse wheel event.Wheel events follow Java (see <a href="http://docs.oracle.com/javase/6/docs/api/java/awt/event/MouseWheelEvent.html#getWheelRotation()">here</a>), so
75
- getAmount() will return "negative values if the mouse wheel was rotated
76
- up or away from the user" and positive values in the other direction.
77
- * On Mac OS X, this will be reversed when "natural" scrolling is enabled
78
- in System Preferences &rarr Mouse.
79
- * @return
80
- */
81
- public int getCount() {
82
- return count;
83
- }
84
-
85
-
86
- private String actionString() {
87
- switch (action) {
88
- default:
89
- return "UNKNOWN";
90
- case CLICK:
91
- return "CLICK";
92
- case DRAG:
93
- return "DRAG";
94
- case ENTER:
95
- return "ENTER";
96
- case EXIT:
97
- return "EXIT";
98
- case MOVE:
99
- return "MOVE";
100
- case PRESS:
101
- return "PRESS";
102
- case RELEASE:
103
- return "RELEASE";
104
- case WHEEL:
105
- return "WHEEL";
106
- }
107
- }
108
-
109
- @Override
110
- public String toString() {
111
- return String.format("<MouseEvent %s@%d,%d count:%d button:%d>",
112
- actionString(), x, y, count, button);
113
- }
114
- }