diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/demos/es1/RedSquare.java | 20 | ||||
-rwxr-xr-x | src/demos/es1/angeles/Main.java | 21 |
2 files changed, 31 insertions, 10 deletions
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index 913a099..fa6b435 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -10,10 +10,16 @@ import com.sun.javafx.newt.*; public class RedSquare implements MouseListener { public boolean quit = false; + public boolean toggleFS = false; public void mouseClicked(MouseEvent e) { - if(e.getClickCount()>1) { - quit=true; + switch(e.getClickCount()) { + case 1: + toggleFS=true; + break; + default: + quit=true; + break; } } public void mouseEntered(MouseEvent e) { @@ -42,9 +48,8 @@ public class RedSquare implements MouseListener { // Size OpenGL to Video Surface int width = 800; int height = 480; - if (!window.setFullscreen(true)) { - window.setSize(width, height); - } + window.setSize(width, height); + window.setFullscreen(true); // Hook this into EGL GLDrawableFactory factory = GLDrawableFactory.getFactory(GLDrawableFactory.PROFILE_GLES1, window); @@ -122,6 +127,11 @@ public class RedSquare implements MouseListener { drawable.swapBuffers(); + if(ml.toggleFS) { + window.setFullscreen(!window.isFullscreen()); + ml.toggleFS=false; + } + window.pumpMessages(); try { diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java index a79139d..b5b74d0 100755 --- a/src/demos/es1/angeles/Main.java +++ b/src/demos/es1/angeles/Main.java @@ -7,10 +7,16 @@ import com.sun.javafx.newt.*; public class Main implements MouseListener { public boolean quit = false; + public boolean toggleFS = false; public void mouseClicked(MouseEvent e) { - if(e.getClickCount()>1) { - quit=true; + switch(e.getClickCount()) { + case 1: + toggleFS=true; + break; + default: + quit=true; + break; } } public void mouseEntered(MouseEvent e) { @@ -39,9 +45,8 @@ public class Main implements MouseListener { // Size OpenGL to Video Surface int width = 800; int height = 480; - if (!window.setFullscreen(true)) { - window.setSize(width, height); - } + window.setSize(width, height); + window.setFullscreen(true); // Hook this into EGL GLDrawableFactory factory = GLDrawableFactory.getFactory(GLDrawableFactory.PROFILE_GLES1, window); @@ -69,6 +74,12 @@ public class Main implements MouseListener { do { angel.display(gl); drawable.swapBuffers(); + + if(ml.toggleFS) { + window.setFullscreen(!window.isFullscreen()); + ml.toggleFS=false; + } + window.pumpMessages(); // Thread.yield(); |