summary refs log tree commit diff stats
path: root/src/com/fourisland
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-02-15 15:13:03 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-02-15 15:13:03 -0500
commit3a4deb5e85844c5862af1fb8afebcacc61e8bfe7 (patch)
treed3c55cfa329a23117c8d040845b80bdb93b20c57 /src/com/fourisland
parent1fb7799ff91729285bf145b2c78f9233a61ac35c (diff)
downloadfourpuzzle-3a4deb5e85844c5862af1fb8afebcacc61e8bfe7.tar.gz
fourpuzzle-3a4deb5e85844c5862af1fb8afebcacc61e8bfe7.tar.bz2
fourpuzzle-3a4deb5e85844c5862af1fb8afebcacc61e8bfe7.zip
Engine: Hid PuzzleApplication's gameFrame
Diffstat (limited to 'src/com/fourisland')
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/Display.java8
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/PuzzleApplication.java24
2 files changed, 16 insertions, 16 deletions
diff --git a/src/com/fourisland/fourpuzzle/Display.java b/src/com/fourisland/fourpuzzle/Display.java index de72c4d..686bd8e 100755 --- a/src/com/fourisland/fourpuzzle/Display.java +++ b/src/com/fourisland/fourpuzzle/Display.java
@@ -12,6 +12,7 @@ import com.fourisland.fourpuzzle.transition.Transition;
12import com.fourisland.fourpuzzle.transition.TransitionDirection; 12import com.fourisland.fourpuzzle.transition.TransitionDirection;
13import com.fourisland.fourpuzzle.transition.TransitionUnsupportedException; 13import com.fourisland.fourpuzzle.transition.TransitionUnsupportedException;
14import com.fourisland.fourpuzzle.util.Renderable; 14import com.fourisland.fourpuzzle.util.Renderable;
15import java.awt.Component;
15import java.awt.Font; 16import java.awt.Font;
16import java.awt.FontFormatException; 17import java.awt.FontFormatException;
17import java.awt.FontMetrics; 18import java.awt.FontMetrics;
@@ -27,7 +28,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
27import java.util.concurrent.CountDownLatch; 28import java.util.concurrent.CountDownLatch;
28import java.util.logging.Level; 29import java.util.logging.Level;
29import java.util.logging.Logger; 30import java.util.logging.Logger;
30import javax.swing.JDialog;
31import org.jdesktop.application.ResourceMap; 31import org.jdesktop.application.ResourceMap;
32 32
33/** 33/**
@@ -40,7 +40,7 @@ public class Display {
40 40
41 private static List<Renderable> renderables = new CopyOnWriteArrayList<Renderable>(); 41 private static List<Renderable> renderables = new CopyOnWriteArrayList<Renderable>();
42 42
43 public static void render(JDialog gameFrame) 43 public static void render(Component gameFrame)
44 { 44 {
45 VolatileImage vImg = gameFrame.createVolatileImage(Game.WIDTH, Game.HEIGHT); 45 VolatileImage vImg = gameFrame.createVolatileImage(Game.WIDTH, Game.HEIGHT);
46 render(gameFrame, vImg); 46 render(gameFrame, vImg);
@@ -61,7 +61,7 @@ public class Display {
61 img = vImg; 61 img = vImg;
62 } while (vImg.contentsLost()); 62 } while (vImg.contentsLost());
63 63
64 gameFrame.getContentPane().getGraphics().drawImage(img, 0, 0, gameFrame.getContentPane().getWidth(), gameFrame.getContentPane().getHeight(), gameFrame); 64 gameFrame.getGraphics().drawImage(img, 0, 0, gameFrame.getWidth(), gameFrame.getHeight(), gameFrame);
65 img.flush(); 65 img.flush();
66 Toolkit.getDefaultToolkit().sync(); 66 Toolkit.getDefaultToolkit().sync();
67 67
@@ -73,7 +73,7 @@ public class Display {
73 } 73 }
74 } 74 }
75 75
76 private static void render(JDialog gameFrame, VolatileImage vImg) 76 private static void render(Component gameFrame, VolatileImage vImg)
77 { 77 {
78 if (vImg.validate(gameFrame.getGraphicsConfiguration()) == VolatileImage.IMAGE_INCOMPATIBLE) 78 if (vImg.validate(gameFrame.getGraphicsConfiguration()) == VolatileImage.IMAGE_INCOMPATIBLE)
79 { 79 {
diff --git a/src/com/fourisland/fourpuzzle/PuzzleApplication.java b/src/com/fourisland/fourpuzzle/PuzzleApplication.java index 069b126..f5c461e 100755 --- a/src/com/fourisland/fourpuzzle/PuzzleApplication.java +++ b/src/com/fourisland/fourpuzzle/PuzzleApplication.java
@@ -9,6 +9,7 @@ import com.fourisland.fourpuzzle.database.Vocabulary;
9import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState; 9import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState;
10import com.fourisland.fourpuzzle.util.Interval; 10import com.fourisland.fourpuzzle.util.Interval;
11import com.fourisland.fourpuzzle.window.SystemGraphic; 11import com.fourisland.fourpuzzle.window.SystemGraphic;
12import java.awt.Frame;
12import java.awt.GraphicsEnvironment; 13import java.awt.GraphicsEnvironment;
13import java.awt.event.KeyAdapter; 14import java.awt.event.KeyAdapter;
14import java.awt.event.KeyEvent; 15import java.awt.event.KeyEvent;
@@ -26,7 +27,6 @@ import org.jdesktop.application.Application;
26public class PuzzleApplication extends Application { 27public class PuzzleApplication extends Application {
27 28
28 public static PuzzleApplication INSTANCE; 29 public static PuzzleApplication INSTANCE;
29 public static JDialog gameFrame;
30 public static boolean debugSpeed = false; 30 public static boolean debugSpeed = false;
31 public static boolean stretchScreen = true; 31 public static boolean stretchScreen = true;
32 public static boolean gameSleep = false; 32 public static boolean gameSleep = false;
@@ -42,11 +42,11 @@ public class PuzzleApplication extends Application {
42 protected void startup() { 42 protected void startup() {
43 INSTANCE = this; 43 INSTANCE = this;
44 44
45 gameFrame = new JDialog(new JFrame(), false); 45 final JDialog gameDialog = new JDialog(new JFrame(), false);
46 gameFrame.setTitle(Database.getVocab(Vocabulary.Title)); 46 gameDialog.setTitle(Database.getVocab(Vocabulary.Title));
47 gameFrame.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); 47 gameDialog.setSize(Game.WIDTH * 2, Game.HEIGHT * 2);
48 gameFrame.setResizable(false); 48 gameDialog.setResizable(false);
49 gameFrame.addWindowListener(new WindowAdapter() { 49 gameDialog.addWindowListener(new WindowAdapter() {
50 @Override 50 @Override
51 public void windowClosing(WindowEvent e) { 51 public void windowClosing(WindowEvent e) {
52 System.exit(0); 52 System.exit(0);
@@ -62,22 +62,22 @@ public class PuzzleApplication extends Application {
62 gameSleep = true; 62 gameSleep = true;
63 } 63 }
64 }); 64 });
65 gameFrame.addKeyListener(new KeyAdapter() { 65 gameDialog.addKeyListener(new KeyAdapter() {
66 @Override 66 @Override
67 public void keyPressed(KeyEvent e) 67 public void keyPressed(KeyEvent e)
68 { 68 {
69 if (e.getKeyCode() == KeyEvent.VK_F4) 69 if (e.getKeyCode() == KeyEvent.VK_F4)
70 { 70 {
71 GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(gameFrame); 71 GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(gameDialog);
72 } else if (e.getKeyCode() == KeyEvent.VK_F5) 72 } else if (e.getKeyCode() == KeyEvent.VK_F5)
73 { 73 {
74 stretchScreen = !stretchScreen; 74 stretchScreen = !stretchScreen;
75 75
76 if (stretchScreen) 76 if (stretchScreen)
77 { 77 {
78 gameFrame.setSize(Game.WIDTH * 2, Game.HEIGHT * 2); 78 gameDialog.setSize(Game.WIDTH * 2, Game.HEIGHT * 2);
79 } else { 79 } else {
80 gameFrame.setSize(Game.WIDTH, Game.HEIGHT); 80 gameDialog.setSize(Game.WIDTH, Game.HEIGHT);
81 } 81 }
82 } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) 82 } else if (e.getKeyCode() == KeyEvent.VK_SHIFT)
83 { 83 {
@@ -101,7 +101,7 @@ public class PuzzleApplication extends Application {
101 } 101 }
102 } 102 }
103 }); 103 });
104 gameFrame.setVisible(true); 104 gameDialog.setVisible(true);
105 105
106 new Thread(new Runnable() { 106 new Thread(new Runnable() {
107 public void run() { 107 public void run() {
@@ -123,7 +123,7 @@ public class PuzzleApplication extends Application {
123 Game.getGameState().doGameCycle(); 123 Game.getGameState().doGameCycle();
124 } 124 }
125 125
126 Display.render(gameFrame); 126 Display.render(gameDialog.getContentPane());
127 } 127 }
128 } 128 }
129 } catch (RuntimeException ex) { 129 } catch (RuntimeException ex) {