finish exit() function, add ESC to kill present mode and applets

This commit is contained in:
benfry
2005-05-13 07:28:11 +00:00
parent 4bfd64c54c
commit f59fa8ea6e
3 changed files with 50 additions and 34 deletions
+38 -20
View File
@@ -1424,6 +1424,12 @@ public class PApplet extends Applet
keyTyped();
break;
}
// if someone else wants to intercept the key, they should
// set key to zero (or something besides the ESC).
if (key == KeyEvent.VK_ESCAPE) {
exit();
}
}
@@ -1817,7 +1823,11 @@ public class PApplet extends Applet
*/
public void exit() {
stop();
// TODO if not running as an applet, do a System.exit() here
finished = true;
if ((leechErr == null) && !online) {
System.exit(0);
}
}
@@ -5376,29 +5386,37 @@ v PApplet.this.stop();
(fullscreen.height - applet.height) / 2,
applet.width, applet.height);
if (external) {
Label label = new Label("stop");
label.setForeground(stopColor);
label.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
// doesn't help for gl, since it has its own canvas
/*
applet.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
System.out.println(e);
if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
//System.out.println("escape!");
System.exit(0);
}
});
frame.add(label);
}
});
*/
/*
frame.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
System.out.println(e);
}
});
*/
Label label = new Label("stop");
label.setForeground(stopColor);
label.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
System.exit(0);
}
});
frame.add(label);
Dimension labelSize = label.getPreferredSize();
// sometimes shows up truncated on mac
labelSize = new Dimension(labelSize.width * 2, labelSize.height);
label.setSize(labelSize);
label.setLocation(20, fullscreen.height - labelSize.height - 20);
Dimension labelSize = label.getPreferredSize();
// sometimes shows up truncated on mac
//System.out.println("label width is " + labelSize.width);
labelSize = new Dimension(100, labelSize.height);
label.setSize(labelSize);
label.setLocation(20, fullscreen.height - labelSize.height - 20);
// not always running externally when in present mode
if (external) {
applet.setupExternal(frame);
}
+12 -13
View File
@@ -8,11 +8,17 @@ o make the 1.4 code in PApplet load via reflection
X doesn't appear necessary with 1.3 applets
o or is some of the stuff usable in 1.3 but not all?
o ie. the device config classes exist but not the set full screen method
_ currently some bugs in the main() because it's not sizing applets
_ if running in present mode it works ok
_ but that also needs its display set.. argh
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115834600;start=0
X currently some bugs in the main() because it's not sizing applets
X if running in present mode it works ok
X but that also needs its display set.. argh
X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115834600;start=0
X add exit() function to actually explicitly quit
X scripts will just require that people include exit at the end
X esc should kill fullscreen mode (actually now it just quits anything)
X can a key handler be added to the window? not really
X add an escape listener to the applet tho.. but will it work with gl?
X how can this be shut off for presentations?
X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114027594;start=0
_ need to test/straighten out load/update pixels
loadPixels() and updatePixels() only need to be used when
@@ -94,10 +100,7 @@ _ should image i/o and sound i/o be moved into PImage and PSound?
_ how to load external encoders/decoders
_ placement of 100x100 items is odd
_ happens with P3D and maybe also P2D?
_ scripting issues
_ how to make a long setup() sleep so that things don't lock way up
_ add exit() function to actually explicitly quit
_ scripts will just require that people include exit at the end
_ scripts: how to make a long setup() sleep so that things don't lock way up
_ fileInput() and fileOutput() may not agree with draw()
_ not yet verified
_ can only be used inside of setup()?
@@ -113,10 +116,6 @@ CORE / PApplet - main()
_ present mode is flakey.. applet doesn't always come up
_ seems like hitting stop helps shut it down?
_ is full screen window not being taken down properly?
_ esc should kill fullscreen mode
_ can a key handler be added to the window?
_ how can this be shut off for presentations?
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114027594;start=0
_ implement full screen mode.. this takes over the screen as best it can
_ size(screen.width, screen.height, OPENGL);
_ if size is screen.width and screen.height, does its best
-1
View File
@@ -93,7 +93,6 @@ public class PGraphicsGL extends PGraphics3 {
canvas.setBounds(0, 0, width, height);
//System.out.println("creating PGraphicsGL 5");
//System.out.println("adding canvas listeners");
canvas.addMouseListener(applet);
canvas.addMouseMotionListener(applet);