From 04053312e8b8d27fb95aed807009a58489025923 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 1 Jun 2008 10:43:49 +0000 Subject: wip git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@241 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/demos/es1/RedSquare.java | 20 +++++++++++++++----- 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(); -- cgit v1.2.3