summaryrefslogtreecommitdiffstats
path: root/src/demos/es1/RedSquare.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-03-13 12:10:29 +0000
committerSven Gothel <[email protected]>2009-03-13 12:10:29 +0000
commit8417ded5c1f892b58a4608ff248842c8aed4026a (patch)
treef9ce74136307bd122c72cec3babd03c26052e9df /src/demos/es1/RedSquare.java
parente03aaaf1b14cc40cb2c8f2158acf02390c4fafe6 (diff)
Adapt to JOGL nwi package changes
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@320 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/es1/RedSquare.java')
-rwxr-xr-xsrc/demos/es1/RedSquare.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java
index 04ea334..56a367a 100755
--- a/src/demos/es1/RedSquare.java
+++ b/src/demos/es1/RedSquare.java
@@ -1,6 +1,7 @@
package demos.es1;
import java.nio.*;
+import javax.media.nwi.*;
import javax.media.opengl.*;
import javax.media.opengl.sub.fixed.*;
import javax.media.opengl.util.*;
@@ -10,12 +11,22 @@ import com.sun.opengl.impl.fixed.GLFixedFuncImpl;
import com.sun.javafx.newt.*;
-public class RedSquare implements MouseListener, GLEventListener {
+public class RedSquare implements KeyListener, MouseListener, GLEventListener {
private GLWindow window;
private GLU glu;
private boolean quit = false;
+ public void keyPressed(KeyEvent e) {
+ System.out.println(e);
+ }
+ public void keyReleased(KeyEvent e) {
+ System.out.println(e);
+ }
+ public void keyTyped(KeyEvent e) {
+ System.out.println(e);
+ }
+
public void mouseClicked(MouseEvent e) {
System.out.println("mouseevent: "+e);
switch(e.getClickCount()) {
@@ -46,7 +57,7 @@ public class RedSquare implements MouseListener, GLEventListener {
System.err.println("RedSquare.run()");
GLProfile.setProfileGLAny();
try {
- GLCapabilities caps = new GLCapabilities();
+ NWCapabilities caps = new NWCapabilities();
// For emulation library, use 16 bpp
caps.setRedBits(5);
caps.setGreenBits(6);
@@ -62,6 +73,7 @@ public class RedSquare implements MouseListener, GLEventListener {
window = GLWindow.create(nWindow, caps);
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 ..
@@ -69,7 +81,7 @@ public class RedSquare implements MouseListener, GLEventListener {
window.enablePerfLog(true);
// Size OpenGL to Video Surface
window.setSize(width, height);
- window.setFullscreen(true);
+ // window.setFullscreen(true);
window.setVisible(true);
while (!quit && window.getDuration() < 20000) {