diff options
Diffstat (limited to 'src/test/com')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java | 12 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java | 18 |
2 files changed, 25 insertions, 5 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index 594f427ca..3fa61bf1d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -270,6 +270,12 @@ public class GearsES2 implements GLEventListener { st.useProgram(gl, false); } + boolean confinedFixedCenter = false; + + public void setConfinedFixedCenter(boolean v) { + confinedFixedCenter = v; + } + class GearsKeyAdapter extends KeyAdapter { public void keyPressed(KeyEvent e) { int kc = e.getKeyCode(); @@ -294,7 +300,7 @@ public class GearsES2 implements GLEventListener { public void mouseReleased(MouseEvent e) { } - public void mouseMoved(MouseEvent e) { + public void mouseMoved(MouseEvent e) { if(e.isConfined()) { navigate(e); } else { @@ -326,12 +332,12 @@ public class GearsES2 implements GLEventListener { height=comp.getHeight(); } else { throw new RuntimeException("Event source neither Window nor Component: "+source); - } + } final float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width); final float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height); view_rotx += thetaX; view_roty += thetaY; - if(e.isConfined() && null!=window) { + if(e.isConfined() && confinedFixedCenter && null!=window) { x=window.getWidth()/2; y=window.getHeight()/2; window.warpPointer(x, y); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java index 9846b2e69..18a5a5d31 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java @@ -68,8 +68,10 @@ public class TestGearsES2NEWT extends UITestCase { glp = GLProfile.getGL2ES2(); } Assert.assertNotNull(glp); - width = 512; - height = 512; + // width = 512; + // height = 512; + width = 200; + height = 200; } @AfterClass @@ -82,6 +84,7 @@ public class TestGearsES2NEWT extends UITestCase { Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+")"); glWindow.setSize(width, height); + glWindow.setPosition(100, 100); glWindow.setUndecorated(undecorated); glWindow.setAlwaysOnTop(alwaysOnTop); glWindow.setFullscreen(fullscreen); @@ -163,6 +166,17 @@ public class TestGearsES2NEWT extends UITestCase { System.err.println("[set mouse confined pre]: "+glWindow.isPointerConfined()); glWindow.confinePointer(!glWindow.isPointerConfined()); System.err.println("[set mouse confined post]: "+glWindow.isPointerConfined()); + if(!glWindow.isPointerConfined()) { + demo.setConfinedFixedCenter(false); + } + } }.start(); + } else if(e.getKeyChar()=='J') { + new Thread() { + public void run() { + System.err.println("[set mouse confined pre]: "+glWindow.isPointerConfined()); + glWindow.confinePointer(!glWindow.isPointerConfined()); + System.err.println("[set mouse confined post]: "+glWindow.isPointerConfined()); + demo.setConfinedFixedCenter(glWindow.isPointerConfined()); } }.start(); } else if(e.getKeyChar()=='w') { new Thread() { |