diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-02-15 18:54:40 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-02-15 18:54:40 -0500 |
commit | 8828c24afa7c11e1c24299f0a445231260cfa508 (patch) | |
tree | b6100773386ab91dbfecc42ce4d08543d74072b7 /src | |
parent | 3a4deb5e85844c5862af1fb8afebcacc61e8bfe7 (diff) | |
download | fourpuzzle-8828c24afa7c11e1c24299f0a445231260cfa508.tar.gz fourpuzzle-8828c24afa7c11e1c24299f0a445231260cfa508.tar.bz2 fourpuzzle-8828c24afa7c11e1c24299f0a445231260cfa508.zip |
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
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/fourisland/fourpuzzle/PuzzleApplication.java | 12 |
1 files changed, 6 insertions, 6 deletions
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; | |||
9 | import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState; | 9 | import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState; |
10 | import com.fourisland.fourpuzzle.util.Interval; | 10 | import com.fourisland.fourpuzzle.util.Interval; |
11 | import com.fourisland.fourpuzzle.window.SystemGraphic; | 11 | import com.fourisland.fourpuzzle.window.SystemGraphic; |
12 | import java.awt.Frame; | ||
13 | import java.awt.GraphicsEnvironment; | 12 | import java.awt.GraphicsEnvironment; |
14 | import java.awt.event.KeyAdapter; | 13 | import java.awt.event.KeyAdapter; |
15 | import java.awt.event.KeyEvent; | 14 | import java.awt.event.KeyEvent; |
@@ -46,6 +45,8 @@ public class PuzzleApplication extends Application { | |||
46 | gameDialog.setTitle(Database.getVocab(Vocabulary.Title)); | 45 | gameDialog.setTitle(Database.getVocab(Vocabulary.Title)); |
47 | gameDialog.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); | 46 | gameDialog.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); |
48 | gameDialog.setResizable(false); | 47 | gameDialog.setResizable(false); |
48 | gameDialog.setUndecorated(true); | ||
49 | gameDialog.setLocation(GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint().x-Game.WIDTH, GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint().y-Game.HEIGHT); | ||
49 | gameDialog.addWindowListener(new WindowAdapter() { | 50 | gameDialog.addWindowListener(new WindowAdapter() { |
50 | @Override | 51 | @Override |
51 | public void windowClosing(WindowEvent e) { | 52 | public void windowClosing(WindowEvent e) { |
@@ -68,16 +69,13 @@ public class PuzzleApplication extends Application { | |||
68 | { | 69 | { |
69 | if (e.getKeyCode() == KeyEvent.VK_F4) | 70 | if (e.getKeyCode() == KeyEvent.VK_F4) |
70 | { | 71 | { |
71 | GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(gameDialog); | ||
72 | } else if (e.getKeyCode() == KeyEvent.VK_F5) | ||
73 | { | ||
74 | stretchScreen = !stretchScreen; | 72 | stretchScreen = !stretchScreen; |
75 | 73 | ||
76 | if (stretchScreen) | 74 | if (stretchScreen) |
77 | { | 75 | { |
78 | gameDialog.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); | 76 | GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(gameDialog); |
79 | } else { | 77 | } else { |
80 | gameDialog.setSize(Game.WIDTH, Game.HEIGHT); | 78 | GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null); |
81 | } | 79 | } |
82 | } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) | 80 | } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) |
83 | { | 81 | { |
@@ -102,6 +100,8 @@ public class PuzzleApplication extends Application { | |||
102 | } | 100 | } |
103 | }); | 101 | }); |
104 | gameDialog.setVisible(true); | 102 | gameDialog.setVisible(true); |
103 | |||
104 | GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(gameDialog); | ||
105 | 105 | ||
106 | new Thread(new Runnable() { | 106 | new Thread(new Runnable() { |
107 | public void run() { | 107 | public void run() { |