summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-09-29 10:02:28 -0700
committerSven Gothel <[email protected]>2009-09-29 10:02:28 -0700
commit30c1fe267c0cf47a25db06ac93c6065881af2a20 (patch)
tree9219267ce49ace1ac5215ad23c0c9aa3e0f029a3
parentc752f7117dc38eed1caa870d7c96a084cea04f88 (diff)
GLNewtRun: Add parenting re-pos/re-size test; JOGLNewtAppletBase: Remove GLProfile, must be used in Capabilities/Window construction phase
-rwxr-xr-xsrc/demos/GLNewtRun.java29
-rwxr-xr-xsrc/demos/applets/JOGLNewtApplet1Run.java1
-rwxr-xr-xsrc/demos/applets/JOGLNewtAppletBase.java3
3 files changed, 28 insertions, 5 deletions
diff --git a/src/demos/GLNewtRun.java b/src/demos/GLNewtRun.java
index 9e31d6b..dca68b4 100755
--- a/src/demos/GLNewtRun.java
+++ b/src/demos/GLNewtRun.java
@@ -26,12 +26,27 @@ public class GLNewtRun implements WindowListener, KeyListener, MouseListener {
quit = true;
}
+ static int dx=0;
+ static int dy=0;
+ static int dw=0;
+ static int dh=0;
+
public void keyPressed(KeyEvent e) {
System.out.println(e);
if(e.getKeyChar()=='f') {
window.setFullscreen(!window.isFullscreen());
} else if(e.getKeyChar()=='q') {
quit = true;
+ } else if(e.getKeyChar()=='p') {
+ int x = window.getX() + dx;
+ int y = window.getY() + dy;
+ System.out.println("Reset Pos "+x+"/"+y);
+ window.setPosition(x, y);
+ } else if(e.getKeyChar()=='s') {
+ int w = window.getWidth() + dw;
+ int h = window.getHeight() + dh;
+ System.out.println("Reset Size "+w+"x"+h);
+ window.setSize(w, h);
}
}
public void keyReleased(KeyEvent e) {
@@ -131,6 +146,18 @@ public class GLNewtRun implements WindowListener, KeyListener, MouseListener {
height = str2int(args[i], height);
} else if(args[i].startsWith("-GL")) {
glProfileStr = args[i].substring(1);
+ } else if(args[i].equals("-dx")) {
+ i++;
+ dx = str2int(args[i], dx);
+ } else if(args[i].equals("-dy")) {
+ i++;
+ dy = str2int(args[i], dy);
+ } else if(args[i].equals("-dw")) {
+ i++;
+ dw = str2int(args[i], dw);
+ } else if(args[i].equals("-dh")) {
+ i++;
+ dh = str2int(args[i], dh);
}
i++;
}
@@ -172,7 +199,7 @@ public class GLNewtRun implements WindowListener, KeyListener, MouseListener {
if(parented) {
Window parent = NewtFactory.createWindow(nScreen, caps, undecorated);
parent.setPosition(x_p, y_p);
- parent.setSize(2*width, 2*height);
+ parent.setSize(width+width/10, height+height/10);
parent.setVisible(true);
nWindow = NewtFactory.createWindow(parent.getWindowHandle(), nScreen, caps, undecorated);
} else {
diff --git a/src/demos/applets/JOGLNewtApplet1Run.java b/src/demos/applets/JOGLNewtApplet1Run.java
index 8080fe4..2d8cd3c 100755
--- a/src/demos/applets/JOGLNewtApplet1Run.java
+++ b/src/demos/applets/JOGLNewtApplet1Run.java
@@ -45,7 +45,6 @@ public class JOGLNewtApplet1Run extends Applet {
throw new RuntimeException("No applet parameter 'gl_event_listener_class'");
}
base = new JOGLNewtAppletBase(glEventListenerClazzName,
- glProfileName,
glSwapInterval,
handleWindowEvents,
useGLInEventHandler,
diff --git a/src/demos/applets/JOGLNewtAppletBase.java b/src/demos/applets/JOGLNewtAppletBase.java
index 4246e4a..54dcf8f 100755
--- a/src/demos/applets/JOGLNewtAppletBase.java
+++ b/src/demos/applets/JOGLNewtAppletBase.java
@@ -14,7 +14,6 @@ import com.sun.opengl.util.*;
public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseListener, GLEventListener {
String glEventListenerClazzName;
- String glProfileName;
int glSwapInterval;
boolean handleWindowEvents;
boolean useGLInEventHandler;
@@ -27,7 +26,6 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis
boolean isValid = false;
public JOGLNewtAppletBase(String glEventListenerClazzName,
- String glProfileName,
int glSwapInterval,
boolean handleWindowEvents,
boolean useGLInEventHandler,
@@ -35,7 +33,6 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis
boolean glTrace) {
this.glEventListenerClazzName=glEventListenerClazzName;
- this.glProfileName=glProfileName;
this.glSwapInterval=glSwapInterval;
this.handleWindowEvents=handleWindowEvents;
this.useGLInEventHandler=useGLInEventHandler;