From 8828c24afa7c11e1c24299f0a445231260cfa508 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 15 Feb 2009 18:54:40 -0500 Subject: Engine: Fixed Full Screen Mode Apparently, the window has to be undecorated to be full screen. This has been done, but that results in a non-full screen window with no "X" button. F4 switches full screen mode and F5 has been removed. Fixes #14 --- src/com/fourisland/fourpuzzle/PuzzleApplication.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/com/fourisland/fourpuzzle/PuzzleApplication.java b/src/com/fourisland/fourpuzzle/PuzzleApplication.java index f5c461e..8d5e638 100755 --- a/src/com/fourisland/fourpuzzle/PuzzleApplication.java +++ b/src/com/fourisland/fourpuzzle/PuzzleApplication.java @@ -9,7 +9,6 @@ import com.fourisland.fourpuzzle.database.Vocabulary; import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState; import com.fourisland.fourpuzzle.util.Interval; import com.fourisland.fourpuzzle.window.SystemGraphic; -import java.awt.Frame; import java.awt.GraphicsEnvironment; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -46,6 +45,8 @@ public class PuzzleApplication extends Application { gameDialog.setTitle(Database.getVocab(Vocabulary.Title)); gameDialog.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); gameDialog.setResizable(false); + gameDialog.setUndecorated(true); + gameDialog.setLocation(GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint().x-Game.WIDTH, GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint().y-Game.HEIGHT); gameDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { @@ -67,17 +68,14 @@ public class PuzzleApplication extends Application { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_F4) - { - GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(gameDialog); - } else if (e.getKeyCode() == KeyEvent.VK_F5) { stretchScreen = !stretchScreen; if (stretchScreen) { - gameDialog.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); + GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(gameDialog); } else { - gameDialog.setSize(Game.WIDTH, Game.HEIGHT); + GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null); } } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) { @@ -102,6 +100,8 @@ public class PuzzleApplication extends Application { } }); gameDialog.setVisible(true); + + GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(gameDialog); new Thread(new Runnable() { public void run() { -- cgit 1.4.1