mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
major work to clean up event handling
This commit is contained in:
@@ -229,14 +229,14 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
protected int emouseX, emouseY;
|
||||
protected float emotionX, emotionY;
|
||||
|
||||
/**
|
||||
* Used to set pmotionX/Y to motionX/Y the first time motionX/Y are used,
|
||||
* otherwise pmotionX/Y are always zero, causing a nasty jump.
|
||||
* <P>
|
||||
* Just using (frameCount == 0) won't work since motionXxxxx()
|
||||
* may not be called until a couple frames into things.
|
||||
*/
|
||||
public boolean firstMotion;
|
||||
// /**
|
||||
// * Used to set pmotionX/Y to motionX/Y the first time motionX/Y are used,
|
||||
// * otherwise pmotionX/Y are always zero, causing a nasty jump.
|
||||
// * <P>
|
||||
// * Just using (frameCount == 0) won't work since motionXxxxx()
|
||||
// * may not be called until a couple frames into things.
|
||||
// */
|
||||
// public boolean firstMotion;
|
||||
|
||||
// public int mouseButton;
|
||||
|
||||
@@ -563,7 +563,7 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
// this will be cleared by draw() if it is not overridden
|
||||
looping = true;
|
||||
redraw = true; // draw this guy once
|
||||
firstMotion = true;
|
||||
// firstMotion = true;
|
||||
|
||||
Context context = getApplicationContext();
|
||||
sketchPath = context.getFilesDir().getAbsolutePath();
|
||||
@@ -1985,8 +1985,9 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
// drawing commands can be run inside them. it can't
|
||||
// be before, since a call to background() would wipe
|
||||
// out anything that had been drawn so far.
|
||||
dequeueMotionEvents();
|
||||
dequeueKeyEvents();
|
||||
// dequeueMotionEvents();
|
||||
// dequeueKeyEvents();
|
||||
dequeueEvents();
|
||||
|
||||
handleMethods("draw");
|
||||
|
||||
@@ -2067,17 +2068,197 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class PMotionEvent {
|
||||
InternalEventQueue eventQueue = new InternalEventQueue();
|
||||
|
||||
|
||||
class InternalEventQueue {
|
||||
protected Event queue[] = new Event[10];
|
||||
protected int offset;
|
||||
protected int count;
|
||||
|
||||
synchronized void add(Event e) {
|
||||
if (count == queue.length) {
|
||||
queue = (Event[]) expand(queue);
|
||||
}
|
||||
queue[count++] = e;
|
||||
}
|
||||
|
||||
synchronized Event remove() {
|
||||
if (offset == count) {
|
||||
throw new RuntimeException("Nothing left on the event queue.");
|
||||
}
|
||||
Event outgoing = queue[offset++];
|
||||
if (offset == count) {
|
||||
// All done, time to reset
|
||||
offset = 0;
|
||||
count = 0;
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
synchronized boolean available() {
|
||||
return count != 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an event to the internal event queue, or process it immediately if
|
||||
* the sketch is not currently looping.
|
||||
*/
|
||||
public void postEvent(processing.event.Event pe) {
|
||||
eventQueue.add(pe);
|
||||
|
||||
if (!looping) {
|
||||
dequeueEvents();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void dequeueEvents() {
|
||||
while (eventQueue.available()) {
|
||||
Event e = eventQueue.remove();
|
||||
|
||||
switch (e.getFlavor()) {
|
||||
// case Event.TOUCH:
|
||||
// handleTouchEvent((TouchEvent) e);
|
||||
// break;
|
||||
case Event.MOUSE:
|
||||
handleMouseEvent((MouseEvent) e);
|
||||
break;
|
||||
case Event.KEY:
|
||||
handleKeyEvent((KeyEvent) e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
protected void handleMouseEvent(MouseEvent event) {
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=170
|
||||
// also prevents mouseExited() on the mac from hosing the mouse
|
||||
// position, because x/y are bizarre values on the exit event.
|
||||
// see also the id check below.. both of these go together
|
||||
// if ((id == java.awt.event.MouseEvent.MOUSE_DRAGGED) ||
|
||||
// (id == java.awt.event.MouseEvent.MOUSE_MOVED)) {
|
||||
if (event.getAction() == MouseEvent.DRAG ||
|
||||
event.getAction() == MouseEvent.MOVE) {
|
||||
pmouseX = emouseX;
|
||||
pmouseY = emouseY;
|
||||
mouseX = event.getX();
|
||||
mouseY = event.getY();
|
||||
}
|
||||
|
||||
// Because we only get DRAGGED (and no MOVED) events, pmouseX/Y will make
|
||||
// things jump because they aren't updated while a finger isn't on the
|
||||
// screen. This makes for weirdness with the continuous lines example,
|
||||
// causing it to jump. Since we're emulating the mouse here, do the right
|
||||
// thing for mouse events. It breaks the situation where random taps/clicks
|
||||
// to the screen won't show up as 'previous' values, but that's probably
|
||||
// less common.
|
||||
// if (event.getAction() == MouseEvent.PRESS) {
|
||||
// System.out.println("resetting");
|
||||
//// pmouseX = event.getX();
|
||||
//// pmouseY = event.getY();
|
||||
// firstMotion = true;
|
||||
// }
|
||||
|
||||
// Get the (already processed) button code
|
||||
// mouseButton = event.getButton();
|
||||
|
||||
// Added in 0215 (2.0b7) so that pmouseX/Y behave more like one would
|
||||
// expect from the desktop. This makes the ContinousLines example behave.
|
||||
if (event.getAction() == MouseEvent.PRESS) {
|
||||
mouseX = event.getX();
|
||||
mouseY = event.getY();
|
||||
pmouseX = mouseX;
|
||||
pmouseY = mouseY;
|
||||
dmouseX = mouseX;
|
||||
dmouseY = mouseY;
|
||||
}
|
||||
|
||||
// if (event.getAction() == MouseEvent.RELEASE) {
|
||||
// mouseX = event.getX();
|
||||
// mouseY = event.getY();
|
||||
// }
|
||||
|
||||
// mouseEvent = event;
|
||||
|
||||
// Do this up here in case a registered method relies on the
|
||||
// boolean for mousePressed.
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MouseEvent.PRESS:
|
||||
mousePressed = true;
|
||||
break;
|
||||
case MouseEvent.RELEASE:
|
||||
mousePressed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
handleMethods("mouseEvent", new Object[] { event });
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MouseEvent.PRESS:
|
||||
mousePressed();
|
||||
break;
|
||||
case MouseEvent.RELEASE:
|
||||
mouseReleased();
|
||||
break;
|
||||
case MouseEvent.CLICK:
|
||||
mouseClicked();
|
||||
break;
|
||||
case MouseEvent.DRAG:
|
||||
mouseDragged();
|
||||
break;
|
||||
case MouseEvent.MOVE:
|
||||
mouseMoved();
|
||||
break;
|
||||
case MouseEvent.ENTER:
|
||||
mouseEntered();
|
||||
break;
|
||||
case MouseEvent.EXIT:
|
||||
mouseExited();
|
||||
break;
|
||||
}
|
||||
|
||||
if ((event.getAction() == MouseEvent.DRAG) ||
|
||||
(event.getAction() == MouseEvent.MOVE)) {
|
||||
emouseX = mouseX;
|
||||
emouseY = mouseY;
|
||||
}
|
||||
if (event.getAction() == MouseEvent.PRESS) { // Android-only
|
||||
emouseX = mouseX;
|
||||
emouseY = mouseY;
|
||||
}
|
||||
// if (event.getAction() == MouseEvent.RELEASE) { // Android-only
|
||||
// emouseX = mouseX;
|
||||
// emouseY = mouseY;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// ******************** NOT CURRENTLY IN USE ********************
|
||||
// this class is hiding inside PApplet for now,
|
||||
// until I have a chance to get the API right inside TouchEvent.
|
||||
class AndroidTouchEvent extends TouchEvent {
|
||||
int action;
|
||||
int numPointers;
|
||||
float[] motionX, motionY;
|
||||
float[] motionPressure;
|
||||
int[] mouseX, mouseY;
|
||||
|
||||
void setAction(int action) {
|
||||
this.action = action;
|
||||
AndroidTouchEvent(Object nativeObject, long millis, int action, int modifiers) {
|
||||
super(nativeObject, millis, action, modifiers);
|
||||
}
|
||||
|
||||
// void setAction(int action) {
|
||||
// this.action = action;
|
||||
// }
|
||||
|
||||
void setNumPointers(int n) {
|
||||
numPointers = n;
|
||||
motionX = new float[n];
|
||||
@@ -2109,76 +2290,76 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
Object motionLock = new Object();
|
||||
PMotionEvent[] motionEventQueue;
|
||||
int motionEventCount;
|
||||
|
||||
protected void enqueueMotionEvent(MotionEvent event) {
|
||||
synchronized (motionLock) {
|
||||
// on first run, allocate array for motion events
|
||||
if (motionEventQueue == null) {
|
||||
motionEventQueue = new PMotionEvent[20];
|
||||
for (int i = 0; i < motionEventQueue.length; i++) {
|
||||
motionEventQueue[i] = new PMotionEvent();
|
||||
}
|
||||
}
|
||||
// allocate more PMotionEvent objects if we're out
|
||||
int historyCount = event.getHistorySize();
|
||||
// println("motion: " + motionEventCount + " " + historyCount + " " + motionEventQueue.length);
|
||||
if (motionEventCount + historyCount >= motionEventQueue.length) {
|
||||
int atLeast = motionEventCount + historyCount + 1;
|
||||
PMotionEvent[] temp = new PMotionEvent[max(atLeast, motionEventCount << 1)];
|
||||
if (PApplet.DEBUG) {
|
||||
println("motion: " + motionEventCount + " " + historyCount + " " + motionEventQueue.length);
|
||||
println("allocating " + temp.length + " entries for motion events");
|
||||
}
|
||||
System.arraycopy(motionEventQueue, 0, temp, 0, motionEventCount);
|
||||
motionEventQueue = temp;
|
||||
for (int i = motionEventCount; i < motionEventQueue.length; i++) {
|
||||
motionEventQueue[i] = new PMotionEvent();
|
||||
}
|
||||
}
|
||||
|
||||
// this will be the last event in the list
|
||||
PMotionEvent pme = motionEventQueue[motionEventCount + historyCount];
|
||||
pme.setAction(event.getAction());
|
||||
pme.setNumPointers(event.getPointerCount());
|
||||
pme.setPointers(event);
|
||||
|
||||
// historical events happen before the 'current' values
|
||||
if (pme.action == MotionEvent.ACTION_MOVE && historyCount > 0) {
|
||||
for (int i = 0; i < historyCount; i++) {
|
||||
PMotionEvent hist = motionEventQueue[motionEventCount++];
|
||||
hist.setAction(event.getAction());
|
||||
hist.setNumPointers(event.getPointerCount());
|
||||
hist.setPointers(event, i);
|
||||
}
|
||||
}
|
||||
|
||||
// now step over the last one that we used to assign 'pme'
|
||||
// if historyCount is 0, this just steps over the last
|
||||
motionEventCount++;
|
||||
}
|
||||
}
|
||||
|
||||
protected void dequeueMotionEvents() {
|
||||
synchronized (motionLock) {
|
||||
for (int i = 0; i < motionEventCount; i++) {
|
||||
handleMotionEvent(motionEventQueue[i]);
|
||||
}
|
||||
motionEventCount = 0;
|
||||
}
|
||||
}
|
||||
// Object motionLock = new Object();
|
||||
// AndroidTouchEvent[] motionEventQueue;
|
||||
// int motionEventCount;
|
||||
//
|
||||
// protected void enqueueMotionEvent(MotionEvent event) {
|
||||
// synchronized (motionLock) {
|
||||
// // on first run, allocate array for motion events
|
||||
// if (motionEventQueue == null) {
|
||||
// motionEventQueue = new AndroidTouchEvent[20];
|
||||
// for (int i = 0; i < motionEventQueue.length; i++) {
|
||||
// motionEventQueue[i] = new AndroidTouchEvent();
|
||||
// }
|
||||
// }
|
||||
// // allocate more PMotionEvent objects if we're out
|
||||
// int historyCount = event.getHistorySize();
|
||||
//// println("motion: " + motionEventCount + " " + historyCount + " " + motionEventQueue.length);
|
||||
// if (motionEventCount + historyCount >= motionEventQueue.length) {
|
||||
// int atLeast = motionEventCount + historyCount + 1;
|
||||
// AndroidTouchEvent[] temp = new AndroidTouchEvent[max(atLeast, motionEventCount << 1)];
|
||||
// if (PApplet.DEBUG) {
|
||||
// println("motion: " + motionEventCount + " " + historyCount + " " + motionEventQueue.length);
|
||||
// println("allocating " + temp.length + " entries for motion events");
|
||||
// }
|
||||
// System.arraycopy(motionEventQueue, 0, temp, 0, motionEventCount);
|
||||
// motionEventQueue = temp;
|
||||
// for (int i = motionEventCount; i < motionEventQueue.length; i++) {
|
||||
// motionEventQueue[i] = new AndroidTouchEvent();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // this will be the last event in the list
|
||||
// AndroidTouchEvent pme = motionEventQueue[motionEventCount + historyCount];
|
||||
// pme.setAction(event.getAction());
|
||||
// pme.setNumPointers(event.getPointerCount());
|
||||
// pme.setPointers(event);
|
||||
//
|
||||
// // historical events happen before the 'current' values
|
||||
// if (pme.action == MotionEvent.ACTION_MOVE && historyCount > 0) {
|
||||
// for (int i = 0; i < historyCount; i++) {
|
||||
// AndroidTouchEvent hist = motionEventQueue[motionEventCount++];
|
||||
// hist.setAction(event.getAction());
|
||||
// hist.setNumPointers(event.getPointerCount());
|
||||
// hist.setPointers(event, i);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // now step over the last one that we used to assign 'pme'
|
||||
// // if historyCount is 0, this just steps over the last
|
||||
// motionEventCount++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// protected void dequeueMotionEvents() {
|
||||
// synchronized (motionLock) {
|
||||
// for (int i = 0; i < motionEventCount; i++) {
|
||||
// handleMotionEvent(motionEventQueue[i]);
|
||||
// }
|
||||
// motionEventCount = 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Take action based on a motion event.
|
||||
* Internally updates mouseX, mouseY, mousePressed, and mouseEvent.
|
||||
* Then it calls the event type with no params,
|
||||
* i.e. mousePressed() or mouseReleased() that the user may have
|
||||
* overloaded to do something more useful.
|
||||
*/
|
||||
protected void handleMotionEvent(PMotionEvent pme) {
|
||||
// ******************** NOT CURRENTLY IN USE ********************
|
||||
// Take action based on a motion event.
|
||||
// Internally updates mouseX, mouseY, mousePressed, and mouseEvent.
|
||||
// Then it calls the event type with no params,
|
||||
// i.e. mousePressed() or mouseReleased() that the user may have
|
||||
// overloaded to do something more useful.
|
||||
protected void handleMotionEvent(AndroidTouchEvent pme) {
|
||||
pmotionX = emotionX;
|
||||
pmotionY = emotionY;
|
||||
motionX = pme.motionX[0];
|
||||
@@ -2191,6 +2372,8 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
mouseX = pme.mouseX[0];
|
||||
mouseY = pme.mouseY[0];
|
||||
|
||||
// *** because removed from PApplet
|
||||
boolean firstMotion = false;
|
||||
// this used to only be called on mouseMoved and mouseDragged
|
||||
// change it back if people run into trouble
|
||||
if (firstMotion) {
|
||||
@@ -2333,6 +2516,15 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
emouseY = mouseY;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Added in API 11, so defined here: Constant Value: 4096 (0x00001000)
|
||||
static final int META_CTRL_ON = 4096;
|
||||
// Added in API 11, so defined here: 65536 (0x00010000)
|
||||
static final int META_META_ON = 65536;
|
||||
|
||||
int motionPointerId;
|
||||
|
||||
|
||||
/**
|
||||
@@ -2340,15 +2532,82 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
* called, the events will be queued up until drawing is complete.
|
||||
* If noLoop() has been called, then events will happen immediately.
|
||||
*/
|
||||
protected void nativeMotionEvent(MotionEvent event) {
|
||||
enqueueMotionEvent(event);
|
||||
protected void nativeMotionEvent(android.view.MotionEvent motionEvent) {
|
||||
// enqueueMotionEvent(event);
|
||||
//
|
||||
// // this will be the last event in the list
|
||||
// AndroidTouchEvent pme = motionEventQueue[motionEventCount + historyCount];
|
||||
// pme.setAction(event.getAction());
|
||||
// pme.setNumPointers(event.getPointerCount());
|
||||
// pme.setPointers(event);
|
||||
//
|
||||
// // historical events happen before the 'current' values
|
||||
// if (pme.action == MotionEvent.ACTION_MOVE && historyCount > 0) {
|
||||
// for (int i = 0; i < historyCount; i++) {
|
||||
// AndroidTouchEvent hist = motionEventQueue[motionEventCount++];
|
||||
// hist.setAction(event.getAction());
|
||||
// hist.setNumPointers(event.getPointerCount());
|
||||
// hist.setPointers(event, i);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if not looping, then remove from the queue immediately
|
||||
// in this case, the queue serves as a temporary safe place for the events
|
||||
// to be unpacked into individual events (instead of mixed w/ history)
|
||||
if (!looping) {
|
||||
dequeueMotionEvents();
|
||||
// ACTION_HOVER_ENTER and ACTION_HOVER_EXIT are passed into
|
||||
// onGenericMotionEvent(android.view.MotionEvent)
|
||||
// if we want to implement mouseEntered/Exited
|
||||
|
||||
// http://developer.android.com/reference/android/view/MotionEvent.html
|
||||
// http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html
|
||||
// http://www.techrepublic.com/blog/app-builder/use-androids-gesture-detector-to-translate-a-swipe-into-an-event/1577
|
||||
|
||||
int metaState = motionEvent.getMetaState();
|
||||
int modifiers = 0;
|
||||
if ((metaState & android.view.KeyEvent.META_SHIFT_ON) != 0) {
|
||||
modifiers |= Event.SHIFT;
|
||||
}
|
||||
if ((metaState & META_CTRL_ON) != 0) {
|
||||
modifiers |= Event.CTRL;
|
||||
}
|
||||
if ((metaState & META_META_ON) != 0) {
|
||||
modifiers |= Event.META;
|
||||
}
|
||||
if ((metaState & android.view.KeyEvent.META_ALT_ON) != 0) {
|
||||
modifiers |= Event.ALT;
|
||||
}
|
||||
|
||||
int clickCount = 1; // not really set... (i.e. not catching double taps)
|
||||
int index;
|
||||
|
||||
// MotionEvent.html -> getButtonState() does BUTTON_PRIMARY, SECONDARY, TERTIARY
|
||||
// use this for left/right/etc
|
||||
switch (motionEvent.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
motionPointerId = motionEvent.getPointerId(0);
|
||||
postEvent(new MouseEvent(motionEvent, motionEvent.getEventTime(),
|
||||
MouseEvent.PRESS, modifiers,
|
||||
(int) motionEvent.getX(), (int) motionEvent.getY(),
|
||||
LEFT, clickCount));
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
// int historySize = motionEvent.getHistorySize();
|
||||
index = motionEvent.findPointerIndex(motionPointerId);
|
||||
if (index != -1) {
|
||||
postEvent(new MouseEvent(motionEvent, motionEvent.getEventTime(),
|
||||
MouseEvent.DRAG, modifiers,
|
||||
(int) motionEvent.getX(index), (int) motionEvent.getY(index),
|
||||
LEFT, clickCount));
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
index = motionEvent.findPointerIndex(motionPointerId);
|
||||
if (index != -1) {
|
||||
postEvent(new MouseEvent(motionEvent, motionEvent.getEventTime(),
|
||||
MouseEvent.RELEASE, modifiers,
|
||||
(int) motionEvent.getX(index), (int) motionEvent.getY(index),
|
||||
LEFT, clickCount));
|
||||
}
|
||||
break;
|
||||
}
|
||||
//postEvent(pme);
|
||||
}
|
||||
|
||||
|
||||
@@ -2362,6 +2621,11 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
|
||||
public void mouseMoved() { }
|
||||
|
||||
public void mouseEntered() { }
|
||||
|
||||
public void mouseExited() { }
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -2386,26 +2650,26 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
KeyEvent[] keyEventQueue = new KeyEvent[10];
|
||||
int keyEventCount;
|
||||
|
||||
protected void enqueueKeyEvent(KeyEvent e) {
|
||||
synchronized (keyEventQueue) {
|
||||
if (keyEventCount == keyEventQueue.length) {
|
||||
keyEventQueue = (KeyEvent[]) expand(keyEventQueue);
|
||||
}
|
||||
keyEventQueue[keyEventCount++] = e;
|
||||
}
|
||||
}
|
||||
|
||||
protected void dequeueKeyEvents() {
|
||||
synchronized (keyEventQueue) {
|
||||
for (int i = 0; i < keyEventCount; i++) {
|
||||
handleKeyEvent(keyEventQueue[i]);
|
||||
}
|
||||
keyEventCount = 0;
|
||||
}
|
||||
}
|
||||
// KeyEvent[] keyEventQueue = new KeyEvent[10];
|
||||
// int keyEventCount;
|
||||
//
|
||||
// protected void enqueueKeyEvent(KeyEvent e) {
|
||||
// synchronized (keyEventQueue) {
|
||||
// if (keyEventCount == keyEventQueue.length) {
|
||||
// keyEventQueue = (KeyEvent[]) expand(keyEventQueue);
|
||||
// }
|
||||
// keyEventQueue[keyEventCount++] = e;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// protected void dequeueKeyEvents() {
|
||||
// synchronized (keyEventQueue) {
|
||||
// for (int i = 0; i < keyEventCount; i++) {
|
||||
// handleKeyEvent(keyEventQueue[i]);
|
||||
// }
|
||||
// keyEventCount = 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
protected void handleKeyEvent(KeyEvent event) {
|
||||
@@ -2414,11 +2678,11 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
keyCode = event.getKeyCode();
|
||||
|
||||
switch (event.getAction()) {
|
||||
case KeyEvent.PRESSED:
|
||||
case KeyEvent.PRESS:
|
||||
keyPressed = true;
|
||||
keyPressed();
|
||||
break;
|
||||
case KeyEvent.RELEASED:
|
||||
case KeyEvent.RELEASE:
|
||||
keyPressed = false;
|
||||
keyReleased();
|
||||
break;
|
||||
@@ -2428,7 +2692,7 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
|
||||
// if someone else wants to intercept the key, they should
|
||||
// set key to zero (or something besides the "ESC").
|
||||
if (event.getAction() == KeyEvent.PRESSED &&
|
||||
if (event.getAction() == KeyEvent.PRESS &&
|
||||
event.getKeyCode() == android.view.KeyEvent.KEYCODE_BACK) {
|
||||
exit();
|
||||
}
|
||||
@@ -2449,9 +2713,9 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
int keAction = 0;
|
||||
int action = event.getAction();
|
||||
if (action == android.view.KeyEvent.ACTION_DOWN) {
|
||||
keAction = KeyEvent.PRESSED;
|
||||
keAction = KeyEvent.PRESS;
|
||||
} else if (action == android.view.KeyEvent.ACTION_UP) {
|
||||
keAction = KeyEvent.RELEASED;
|
||||
keAction = KeyEvent.RELEASE;
|
||||
}
|
||||
|
||||
// TODO set up proper key modifier handling
|
||||
@@ -2468,11 +2732,7 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
if (looping) {
|
||||
enqueueKeyEvent(ke);
|
||||
} else {
|
||||
handleKeyEvent(ke);
|
||||
}
|
||||
postEvent(ke);
|
||||
}
|
||||
|
||||
|
||||
@@ -7774,6 +8034,12 @@ public class PApplet extends Activity implements PConstants, Runnable {
|
||||
}
|
||||
|
||||
|
||||
public void arc(float a, float b, float c, float d,
|
||||
float start, float stop, int mode) {
|
||||
g.arc(a, b, c, d, start, stop, mode);
|
||||
}
|
||||
|
||||
|
||||
public void box(float size) {
|
||||
g.box(size);
|
||||
}
|
||||
|
||||
@@ -167,13 +167,6 @@ public interface PConstants {
|
||||
public final static int DODGE = 1 << 12;
|
||||
public final static int BURN = 1 << 13;
|
||||
|
||||
// colour component bitmasks
|
||||
|
||||
public static final int ALPHA_MASK = 0xff000000;
|
||||
public static final int RED_MASK = 0x00ff0000;
|
||||
public static final int GREEN_MASK = 0x0000ff00;
|
||||
public static final int BLUE_MASK = 0x000000ff;
|
||||
|
||||
|
||||
// for messages
|
||||
|
||||
@@ -262,6 +255,13 @@ public interface PConstants {
|
||||
static final int CENTER_DIAMETER = 3;
|
||||
|
||||
|
||||
// arc drawing modes
|
||||
|
||||
//static final int OPEN = 1; // shared
|
||||
static final int CHORD = 2;
|
||||
static final int PIE = 3;
|
||||
|
||||
|
||||
// vertically alignment modes for text
|
||||
|
||||
/** Default vertical alignment for text placement */
|
||||
|
||||
@@ -1995,6 +1995,12 @@ public class PGraphics extends PImage implements PConstants {
|
||||
*/
|
||||
public void arc(float a, float b, float c, float d,
|
||||
float start, float stop) {
|
||||
arc(a, b, c, d, start, stop, 0);
|
||||
}
|
||||
|
||||
|
||||
public void arc(float a, float b, float c, float d,
|
||||
float start, float stop, int mode) {
|
||||
float x = a;
|
||||
float y = b;
|
||||
float w = c;
|
||||
@@ -2015,11 +2021,23 @@ public class PGraphics extends PImage implements PConstants {
|
||||
y = b - d/2f;
|
||||
}
|
||||
|
||||
// make sure this loop will exit before starting while
|
||||
if (Float.isInfinite(start) || Float.isInfinite(stop)) return;
|
||||
while (stop < start) stop += TWO_PI;
|
||||
// make sure the loop will exit before starting while
|
||||
if (!Float.isInfinite(start) && !Float.isInfinite(stop)) {
|
||||
// ignore equal and degenerate cases
|
||||
if (stop > start) {
|
||||
// make sure that we're starting at a useful point
|
||||
while (start < 0) {
|
||||
start += TWO_PI;
|
||||
stop += TWO_PI;
|
||||
}
|
||||
|
||||
arcImpl(x, y, w, h, start, stop);
|
||||
if (stop - start > TWO_PI) {
|
||||
start = 0;
|
||||
stop = TWO_PI;
|
||||
}
|
||||
arcImpl(x, y, w, h, start, stop, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2030,7 +2048,8 @@ public class PGraphics extends PImage implements PConstants {
|
||||
* and the user will still collect $200.
|
||||
*/
|
||||
protected void arcImpl(float x, float y, float w, float h,
|
||||
float start, float stop) {
|
||||
float start, float stop, int mode) {
|
||||
showMissingWarning("arc");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -99,6 +99,12 @@ public class PImage implements PConstants, Cloneable {
|
||||
private int[] blurKernel;
|
||||
private int[][] blurMult;
|
||||
|
||||
// colour component bitmasks (moved from PConstants in 2.0b7)
|
||||
public static final int ALPHA_MASK = 0xff000000;
|
||||
public static final int RED_MASK = 0x00ff0000;
|
||||
public static final int GREEN_MASK = 0x0000ff00;
|
||||
public static final int BLUE_MASK = 0x000000ff;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -29,12 +29,20 @@ public class Event {
|
||||
protected long millis;
|
||||
protected int action;
|
||||
|
||||
static public final int SHIFT_MASK = 1 << 6;
|
||||
static public final int CTRL_MASK = 1 << 7;
|
||||
static public final int META_MASK = 1 << 8;
|
||||
static public final int ALT_MASK = 1 << 9;
|
||||
// These correspond to the java.awt.Event modifiers (not to be confused with
|
||||
// the newer getModifiersEx), though they're not guaranteed to in the future.
|
||||
static public final int SHIFT = 1 << 0;
|
||||
static public final int CTRL = 1 << 1;
|
||||
static public final int META = 1 << 2;
|
||||
static public final int ALT = 1 << 3;
|
||||
protected int modifiers;
|
||||
|
||||
// Types of events. As with all constants in Processing, brevity's preferred.
|
||||
static public final int KEY = 1;
|
||||
static public final int MOUSE = 2;
|
||||
static public final int TOUCH = 3;
|
||||
protected int flavor;
|
||||
|
||||
|
||||
public Event(Object nativeObject, long millis, int action, int modifiers) {
|
||||
this.nativeObject = nativeObject;
|
||||
@@ -44,6 +52,18 @@ public class Event {
|
||||
}
|
||||
|
||||
|
||||
public int getFlavor() {
|
||||
return flavor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the platform-native event object. This might be the java.awt event
|
||||
* on the desktop, though if you're using OpenGL on the desktop it'll be a
|
||||
* NEWT event that JOGL uses. Android events are something else altogether.
|
||||
* Bottom line, use this only if you know what you're doing, and don't make
|
||||
* assumptions about the class type.
|
||||
*/
|
||||
public Object getNative() {
|
||||
return nativeObject;
|
||||
}
|
||||
@@ -85,21 +105,21 @@ public class Event {
|
||||
|
||||
|
||||
public boolean isShiftDown() {
|
||||
return (modifiers & SHIFT_MASK) != 0;
|
||||
return (modifiers & SHIFT) != 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean isControlDown() {
|
||||
return (modifiers & CTRL_MASK) != 0;
|
||||
return (modifiers & CTRL) != 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean isMetaDown() {
|
||||
return (modifiers & META_MASK) != 0;
|
||||
return (modifiers & META) != 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean isAltDown() {
|
||||
return (modifiers & ALT_MASK) != 0;
|
||||
return (modifiers & ALT) != 0;
|
||||
}
|
||||
}
|
||||
@@ -24,9 +24,9 @@ package processing.event;
|
||||
|
||||
|
||||
public class KeyEvent extends Event {
|
||||
static public final int PRESSED = 1;
|
||||
static public final int RELEASED = 2;
|
||||
static public final int TYPED = 3;
|
||||
static public final int PRESS = 1;
|
||||
static public final int RELEASE = 2;
|
||||
static public final int TYPE = 3;
|
||||
|
||||
char key;
|
||||
int keyCode;
|
||||
@@ -36,6 +36,7 @@ public class KeyEvent extends Event {
|
||||
long millis, int action, int modifiers,
|
||||
char key, int keyCode) {
|
||||
super(nativeObject, millis, action, modifiers);
|
||||
this.flavor = KEY;
|
||||
this.key = key;
|
||||
this.keyCode = keyCode;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ package processing.event;
|
||||
|
||||
|
||||
public class MouseEvent extends Event {
|
||||
static public final int PRESSED = 1;
|
||||
static public final int RELEASED = 2;
|
||||
static public final int CLICKED = 3;
|
||||
static public final int DRAGGED = 4;
|
||||
static public final int MOVED = 5;
|
||||
static public final int ENTERED = 6;
|
||||
static public final int EXITED = 7;
|
||||
static public final int PRESS = 1;
|
||||
static public final int RELEASE = 2;
|
||||
static public final int CLICK = 3;
|
||||
static public final int DRAG = 4;
|
||||
static public final int MOVE = 5;
|
||||
static public final int ENTER = 6;
|
||||
static public final int EXIT = 7;
|
||||
|
||||
protected int x, y;
|
||||
protected int button;
|
||||
@@ -50,6 +50,7 @@ public class MouseEvent extends Event {
|
||||
long millis, int action, int modifiers,
|
||||
int x, int y, int button, int clickCount) {
|
||||
super(nativeObject, millis, action, modifiers);
|
||||
this.flavor = MOUSE;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.button = button;
|
||||
|
||||
@@ -23,9 +23,24 @@
|
||||
package processing.event;
|
||||
|
||||
|
||||
/*
|
||||
http://developer.android.com/guide/topics/ui/ui-events.html
|
||||
http://developer.android.com/reference/android/view/MotionEvent.html
|
||||
http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/TouchEvent/TouchEvent.html
|
||||
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIGestureRecognizer_Class/Reference/Reference.html#//apple_ref/occ/cl/UIGestureRecognizer
|
||||
|
||||
Apple's high-level gesture names:
|
||||
tap
|
||||
pinch
|
||||
rotate
|
||||
swipe
|
||||
pan
|
||||
longpress
|
||||
*/
|
||||
public class TouchEvent extends Event {
|
||||
|
||||
public TouchEvent(Object nativeObject, long millis, int action, int modifiers) {
|
||||
super(nativeObject, millis, action, modifiers);
|
||||
this.flavor = TOUCH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,25 @@ X removing default imports for
|
||||
X android.view.MotionEvent, android.view.KeyEvent,android.graphics.Bitmap
|
||||
X due to conflicts w/ the new p5 event system
|
||||
|
||||
cleaning/earlier
|
||||
A Defects in the tessellation of SVG shapes in A3D
|
||||
A http://code.google.com/p/processing/issues/detail?id=291
|
||||
|
||||
|
||||
_ Finish implementation of OPEN and CHORD drawing modes for arc()
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1405
|
||||
|
||||
_ implement blendMode() for Android
|
||||
_ should be fairly straightforward given Java2D implementation
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1386
|
||||
|
||||
_ Update documentation and tools for Android SDK Tools revision 21
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1398
|
||||
|
||||
_ re-implement to use Fragment API
|
||||
_ and what about daydream or widgets or whatever?
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1335
|
||||
|
||||
_ implement Android version of command line tools
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1323
|
||||
|
||||
@@ -30,6 +49,7 @@ _ PApplet.match(scrubbed, processing.mode.java.JavaBuild.SIZE_REGEX);
|
||||
_ test libraries on android
|
||||
|
||||
_ no ES2 in the emulator, and no error reported in the PDE
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1059
|
||||
_ problem is probably that the error comes via E/AndroidRuntime
|
||||
_ java.lang.RuntimeException: Unable to start activity ComponentInfo{processing.test.fisheye/processing.test.fisheye.FishEye}: java.lang.RuntimeException: P3D: OpenGL ES 2.0 is not supported by this device.
|
||||
|
||||
|
||||
@@ -514,7 +514,12 @@ public class PApplet extends Applet
|
||||
* <p>
|
||||
* Just using (frameCount == 0) won't work since mouseXxxxx()
|
||||
* may not be called until a couple frames into things.
|
||||
* <p>
|
||||
* @deprecated Please refrain from using this variable, it will be removed
|
||||
* from future releases of Processing because it cannot be used consistently
|
||||
* across platforms and input methods.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean firstMouse;
|
||||
|
||||
/**
|
||||
@@ -529,9 +534,8 @@ public class PApplet extends Applet
|
||||
*
|
||||
* <h3>Advanced:</h3>
|
||||
*
|
||||
* If running on Mac OS, a ctrl-click will be interpreted as
|
||||
* the righthand mouse button (unlike Java, which reports it as
|
||||
* the left mouse).
|
||||
* If running on Mac OS, a ctrl-click will be interpreted as the right-hand
|
||||
* mouse button (unlike Java, which reports it as the left mouse).
|
||||
* @webref input:mouse
|
||||
* @see PApplet#mouseX
|
||||
* @see PApplet#mouseY
|
||||
@@ -2497,11 +2501,11 @@ public class PApplet extends Applet
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=170
|
||||
// also prevents mouseExited() on the mac from hosing the mouse
|
||||
// position, because x/y are bizarre values on the exit event.
|
||||
// see also the id check below.. both of these go together
|
||||
// if ((id == java.awt.event.MouseEvent.MOUSE_DRAGGED) ||
|
||||
// (id == java.awt.event.MouseEvent.MOUSE_MOVED)) {
|
||||
if (event.getAction() == MouseEvent.DRAGGED ||
|
||||
event.getAction() == MouseEvent.MOVED) {
|
||||
// see also the id check below.. both of these go together.
|
||||
// Not necessary to set mouseX/Y on PRESS or RELEASE events because the
|
||||
// actual position will have been set by a MOVE or DRAG event.
|
||||
if (event.getAction() == MouseEvent.DRAG ||
|
||||
event.getAction() == MouseEvent.MOVE) {
|
||||
pmouseX = emouseX;
|
||||
pmouseY = emouseY;
|
||||
mouseX = event.getX();
|
||||
@@ -2511,7 +2515,7 @@ public class PApplet extends Applet
|
||||
// Get the (already processed) button code
|
||||
mouseButton = event.getButton();
|
||||
|
||||
// Compatibility for older code
|
||||
// Compatibility for older code (these have AWT object params, not P5)
|
||||
if (mouseEventMethods != null) {
|
||||
// Probably also good to check this, in case anyone tries to call
|
||||
// postEvent() with an artificial event they've created.
|
||||
@@ -2536,10 +2540,10 @@ public class PApplet extends Applet
|
||||
// boolean for mousePressed.
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MouseEvent.PRESSED:
|
||||
case MouseEvent.PRESS:
|
||||
mousePressed = true;
|
||||
break;
|
||||
case MouseEvent.RELEASED:
|
||||
case MouseEvent.RELEASE:
|
||||
mousePressed = false;
|
||||
break;
|
||||
}
|
||||
@@ -2547,33 +2551,33 @@ public class PApplet extends Applet
|
||||
handleMethods("mouseEvent", new Object[] { event });
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MouseEvent.PRESSED:
|
||||
case MouseEvent.PRESS:
|
||||
// mousePressed = true;
|
||||
mousePressed();
|
||||
break;
|
||||
case MouseEvent.RELEASED:
|
||||
case MouseEvent.RELEASE:
|
||||
// mousePressed = false;
|
||||
mouseReleased();
|
||||
break;
|
||||
case MouseEvent.CLICKED:
|
||||
case MouseEvent.CLICK:
|
||||
mouseClicked();
|
||||
break;
|
||||
case MouseEvent.DRAGGED:
|
||||
case MouseEvent.DRAG:
|
||||
mouseDragged();
|
||||
break;
|
||||
case MouseEvent.MOVED:
|
||||
case MouseEvent.MOVE:
|
||||
mouseMoved();
|
||||
break;
|
||||
case MouseEvent.ENTERED:
|
||||
case MouseEvent.ENTER:
|
||||
mouseEntered();
|
||||
break;
|
||||
case MouseEvent.EXITED:
|
||||
case MouseEvent.EXIT:
|
||||
mouseExited();
|
||||
break;
|
||||
}
|
||||
|
||||
if ((event.getAction() == MouseEvent.DRAGGED) ||
|
||||
(event.getAction() == MouseEvent.MOVED)) {
|
||||
if ((event.getAction() == MouseEvent.DRAG) ||
|
||||
(event.getAction() == MouseEvent.MOVE)) {
|
||||
emouseX = mouseX;
|
||||
emouseY = mouseY;
|
||||
}
|
||||
@@ -2589,25 +2593,25 @@ public class PApplet extends Applet
|
||||
int peAction = 0;
|
||||
switch (nativeEvent.getID()) {
|
||||
case java.awt.event.MouseEvent.MOUSE_PRESSED:
|
||||
peAction = MouseEvent.PRESSED;
|
||||
peAction = MouseEvent.PRESS;
|
||||
break;
|
||||
case java.awt.event.MouseEvent.MOUSE_RELEASED:
|
||||
peAction = MouseEvent.RELEASED;
|
||||
peAction = MouseEvent.RELEASE;
|
||||
break;
|
||||
case java.awt.event.MouseEvent.MOUSE_CLICKED:
|
||||
peAction = MouseEvent.CLICKED;
|
||||
peAction = MouseEvent.CLICK;
|
||||
break;
|
||||
case java.awt.event.MouseEvent.MOUSE_DRAGGED:
|
||||
peAction = MouseEvent.DRAGGED;
|
||||
peAction = MouseEvent.DRAG;
|
||||
break;
|
||||
case java.awt.event.MouseEvent.MOUSE_MOVED:
|
||||
peAction = MouseEvent.MOVED;
|
||||
peAction = MouseEvent.MOVE;
|
||||
break;
|
||||
case java.awt.event.MouseEvent.MOUSE_ENTERED:
|
||||
peAction = MouseEvent.ENTERED;
|
||||
peAction = MouseEvent.ENTER;
|
||||
break;
|
||||
case java.awt.event.MouseEvent.MOUSE_EXITED:
|
||||
peAction = MouseEvent.EXITED;
|
||||
peAction = MouseEvent.EXIT;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2913,15 +2917,15 @@ public class PApplet extends Applet
|
||||
keyCode = event.getKeyCode();
|
||||
|
||||
switch (event.getAction()) {
|
||||
case KeyEvent.PRESSED:
|
||||
case KeyEvent.PRESS:
|
||||
keyPressed = true;
|
||||
keyPressed();
|
||||
break;
|
||||
case KeyEvent.RELEASED:
|
||||
case KeyEvent.RELEASE:
|
||||
keyPressed = false;
|
||||
keyReleased();
|
||||
break;
|
||||
case KeyEvent.TYPED:
|
||||
case KeyEvent.TYPE:
|
||||
keyTyped();
|
||||
break;
|
||||
}
|
||||
@@ -2934,7 +2938,7 @@ public class PApplet extends Applet
|
||||
|
||||
// if someone else wants to intercept the key, they should
|
||||
// set key to zero (or something besides the ESC).
|
||||
if (event.getAction() == KeyEvent.PRESSED) {
|
||||
if (event.getAction() == KeyEvent.PRESS) {
|
||||
//if (key == java.awt.event.KeyEvent.VK_ESCAPE) {
|
||||
if (key == ESC) {
|
||||
exit();
|
||||
@@ -2962,13 +2966,13 @@ public class PApplet extends Applet
|
||||
int peAction = 0;
|
||||
switch (event.getID()) {
|
||||
case java.awt.event.KeyEvent.KEY_PRESSED:
|
||||
peAction = KeyEvent.PRESSED;
|
||||
peAction = KeyEvent.PRESS;
|
||||
break;
|
||||
case java.awt.event.KeyEvent.KEY_RELEASED:
|
||||
peAction = KeyEvent.RELEASED;
|
||||
peAction = KeyEvent.RELEASE;
|
||||
break;
|
||||
case java.awt.event.KeyEvent.KEY_TYPED:
|
||||
peAction = KeyEvent.TYPED;
|
||||
peAction = KeyEvent.TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -11309,6 +11313,13 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
public void arc(float a, float b, float c, float d,
|
||||
float start, float stop, int mode) {
|
||||
if (recorder != null) recorder.arc(a, b, c, d, start, stop, mode);
|
||||
g.arc(a, b, c, d, start, stop, mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ( begin auto-generated from box.xml )
|
||||
*
|
||||
|
||||
@@ -24,9 +24,9 @@ package processing.event;
|
||||
|
||||
|
||||
public class KeyEvent extends Event {
|
||||
static public final int PRESSED = 1;
|
||||
static public final int RELEASED = 2;
|
||||
static public final int TYPED = 3;
|
||||
static public final int PRESS = 1;
|
||||
static public final int RELEASE = 2;
|
||||
static public final int TYPE = 3;
|
||||
|
||||
char key;
|
||||
int keyCode;
|
||||
|
||||
@@ -26,13 +26,13 @@ package processing.event;
|
||||
|
||||
|
||||
public class MouseEvent extends Event {
|
||||
static public final int PRESSED = 1;
|
||||
static public final int RELEASED = 2;
|
||||
static public final int CLICKED = 3;
|
||||
static public final int DRAGGED = 4;
|
||||
static public final int MOVED = 5;
|
||||
static public final int ENTERED = 6;
|
||||
static public final int EXITED = 7;
|
||||
static public final int PRESS = 1;
|
||||
static public final int RELEASE = 2;
|
||||
static public final int CLICK = 3;
|
||||
static public final int DRAG = 4;
|
||||
static public final int MOVE = 5;
|
||||
static public final int ENTER = 6;
|
||||
static public final int EXIT = 7;
|
||||
|
||||
protected int x, y;
|
||||
protected int button;
|
||||
|
||||
@@ -2615,31 +2615,31 @@ public class PGL {
|
||||
class NEWTMouseAdapter extends com.jogamp.newt.event.MouseAdapter {
|
||||
@Override
|
||||
public void mousePressed(com.jogamp.newt.event.MouseEvent e) {
|
||||
nativeMouseEvent(e, MouseEvent.PRESSED);
|
||||
nativeMouseEvent(e, MouseEvent.PRESS);
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(com.jogamp.newt.event.MouseEvent e) {
|
||||
nativeMouseEvent(e, MouseEvent.RELEASED);
|
||||
nativeMouseEvent(e, MouseEvent.RELEASE);
|
||||
}
|
||||
@Override
|
||||
public void mouseClicked(com.jogamp.newt.event.MouseEvent e) {
|
||||
nativeMouseEvent(e, MouseEvent.CLICKED);
|
||||
nativeMouseEvent(e, MouseEvent.CLICK);
|
||||
}
|
||||
@Override
|
||||
public void mouseDragged(com.jogamp.newt.event.MouseEvent e) {
|
||||
nativeMouseEvent(e, MouseEvent.DRAGGED);
|
||||
nativeMouseEvent(e, MouseEvent.DRAG);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(com.jogamp.newt.event.MouseEvent e) {
|
||||
nativeMouseEvent(e, MouseEvent.MOVED);
|
||||
nativeMouseEvent(e, MouseEvent.MOVE);
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(com.jogamp.newt.event.MouseEvent e) {
|
||||
nativeMouseEvent(e, MouseEvent.ENTERED);
|
||||
nativeMouseEvent(e, MouseEvent.ENTER);
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(com.jogamp.newt.event.MouseEvent e) {
|
||||
nativeMouseEvent(e, MouseEvent.EXITED);
|
||||
nativeMouseEvent(e, MouseEvent.EXIT);
|
||||
}
|
||||
@Override
|
||||
public void mouseWheelMoved(com.jogamp.newt.event.MouseEvent e) {
|
||||
@@ -2651,15 +2651,15 @@ public class PGL {
|
||||
class NEWTKeyAdapter extends com.jogamp.newt.event.KeyAdapter {
|
||||
@Override
|
||||
public void keyPressed(com.jogamp.newt.event.KeyEvent e) {
|
||||
nativeKeyEvent(e, KeyEvent.PRESSED);
|
||||
nativeKeyEvent(e, KeyEvent.PRESS);
|
||||
}
|
||||
@Override
|
||||
public void keyReleased(com.jogamp.newt.event.KeyEvent e) {
|
||||
nativeKeyEvent(e, KeyEvent.RELEASED);
|
||||
nativeKeyEvent(e, KeyEvent.RELEASE);
|
||||
}
|
||||
@Override
|
||||
public void keyTyped(com.jogamp.newt.event.KeyEvent e) {
|
||||
nativeKeyEvent(e, KeyEvent.TYPED);
|
||||
nativeKeyEvent(e, KeyEvent.TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-7
@@ -19,12 +19,12 @@ A http://code.google.com/p/processing/issues/detail?id=1342
|
||||
A Implement anisotropic filtering when using OPENGL
|
||||
A http://code.google.com/p/processing/issues/detail?id=502
|
||||
X move _MASK constants out of PConstants and into PImage
|
||||
|
||||
_ how should stroke work w/ arcs?
|
||||
X how should stroke work w/ arcs?
|
||||
X decision: we should do pie, you can make the other kind w/o it
|
||||
_ add an additional parameter for the others
|
||||
X add an additional parameter for the others
|
||||
_ http://code.google.com/p/processing/issues/detail?id=711
|
||||
|
||||
X changed events to PRESS, RELEASE, CLICK, DRAG, MOVE, ENTER, EXIT
|
||||
X instead of past-tense versions of the same
|
||||
|
||||
cleanup/earlier by Andres
|
||||
A when turning smoothing on, internal lines of shapes are visible
|
||||
@@ -120,9 +120,6 @@ _ change to be th text command
|
||||
_ OutOfMemory in image()
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1353
|
||||
|
||||
_ remove java.awt.* imports from sketches
|
||||
_ go through examples to make sure they're not being used
|
||||
|
||||
_ Default Renderer slow on retina displays
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1262
|
||||
|
||||
|
||||
@@ -1,6 +1,28 @@
|
||||
0215 pde
|
||||
X "expecting EOF, found 'import'" on previously working sketch
|
||||
X http://code.google.com/p/processing/issues/detail?id=1376
|
||||
X changing default imports to only cover those we have in the reference
|
||||
X also on the Android side as well
|
||||
X new set: java.io.*,java.util.*
|
||||
X removed: java.applet.*,java.awt.Dimension,java.awt.Frame,java.awt.event.MouseEvent,java.awt.event.KeyEvent,java.awt.event.FocusEvent,java.awt.Image,
|
||||
X mode detection isn't properly ignoring code inside comments
|
||||
X http://code.google.com/p/processing/issues/detail?id=1404
|
||||
|
||||
_ remove java.awt.* imports from sketches
|
||||
_ go through examples to make sure they're not being used
|
||||
_ do command line to run through all examples?
|
||||
_ consider hard-coding these, the pref can be for additions?
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
_ change error message for serial re: 64-bit
|
||||
_ "To use this library, switch to 32-bit mode in Preferences." (OS X)
|
||||
_ "To use this library, you must use the 32-bit version of Processing."
|
||||
|
||||
_ DebugMode throwing exception about breakpoints when trying to save
|
||||
|
||||
|
||||
Reference in New Issue
Block a user