diff options
author | Sven Gothel <[email protected]> | 2009-06-15 10:18:30 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-06-15 10:18:30 +0000 |
commit | 224f777f62a8b682184d0cdf8fb8470aabf13977 (patch) | |
tree | 618c4bb7d9a832a64ccc4cc65c8f2e44e3620065 | |
parent | 736ed4eb312bc255b9219f60b0f66f2397019adb (diff) |
RedSquare exit on key 'q' as well
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@349 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
-rw-r--r-- | java-dbg.sh | 2 | ||||
-rwxr-xr-x | java-macosx-mainthread.sh | 2 | ||||
-rwxr-xr-x | java-macosx.sh | 2 | ||||
-rwxr-xr-x | src/demos/es1/RedSquare.java | 3 | ||||
-rwxr-xr-x | src/demos/es2/RedSquare.java | 16 |
5 files changed, 21 insertions, 4 deletions
diff --git a/java-dbg.sh b/java-dbg.sh index 4298a82..fd88bcd 100644 --- a/java-dbg.sh +++ b/java-dbg.sh @@ -1,7 +1,7 @@ #! /bin/sh # java -Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all $* 2>&1 | tee java-dbg.log -java -Dnewt.debug.Window -Dnativewindow.debug=all -Djogl.debug=all $* 2>&1 | tee java-dbg.log +java -Dnewt.debug=all -Dnativewindow.debug=all -Djogl.debug=all $* 2>&1 | tee java-dbg.log # java -Djogl.debug=all $* 2>&1 | tee java-dbg.log diff --git a/java-macosx-mainthread.sh b/java-macosx-mainthread.sh index 37d1fb4..d8536fa 100755 --- a/java-macosx-mainthread.sh +++ b/java-macosx-mainthread.sh @@ -1,3 +1,3 @@ #! /bin/sh -java -XstartOnFirstThread com.sun.javafx.newt.util.MainThread $* +java -XstartOnFirstThread -Djava.awt.headless=true com.sun.javafx.newt.util.MainThread $* 2>&1 | tee java-macosx.mainThread.log diff --git a/java-macosx.sh b/java-macosx.sh index d2e2125..ee793df 100755 --- a/java-macosx.sh +++ b/java-macosx.sh @@ -1,3 +1,3 @@ #! /bin/sh -java -XstartOnFirstThread -Djava.awt.headless=true $* +java -XstartOnFirstThread -Djava.awt.headless=true $* 2>&1 | tee java-macosx.log diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index 4227418..58b5e01 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -41,6 +41,9 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void keyPressed(KeyEvent e) { System.out.println(glp+" "+e); + if(e.getKeyCode()==KeyEvent.VK_Q) { + quit = true; + } } public void keyReleased(KeyEvent e) { System.out.println(glp+" "+e); diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index d2149bc..d1d2c5d 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -12,7 +12,7 @@ import com.sun.opengl.util.glsl.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; -public class RedSquare extends Thread implements WindowListener, MouseListener, GLEventListener { +public class RedSquare extends Thread implements WindowListener, KeyListener, MouseListener, GLEventListener { private GLWindow window; private GLProfile glp; @@ -41,6 +41,19 @@ public class RedSquare extends Thread implements WindowListener, MouseListener, quit = true; } + public void keyPressed(KeyEvent e) { + System.out.println(glp+" "+e); + if(e.getKeyCode()==KeyEvent.VK_Q) { + quit = true; + } + } + public void keyReleased(KeyEvent e) { + System.out.println(glp+" "+e); + } + public void keyTyped(KeyEvent e) { + System.out.println(glp+" "+e); + } + public void mouseClicked(MouseEvent e) { System.out.println(glp+" mouseevent: "+e); switch(e.getClickCount()) { @@ -85,6 +98,7 @@ public class RedSquare extends Thread implements WindowListener, MouseListener, window.addWindowListener(this); window.addMouseListener(this); + window.addKeyListener(this); window.addGLEventListener(this); // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_NONE); // no current .. |