diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-02-08 17:12:38 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-02-08 17:12:38 -0500 |
commit | 50928c2d12bf145711df877bb86aadfb1306860b (patch) | |
tree | badafeb8015ff7550d5fe9bf70b0803b5c6aa9b3 /src/com/fourisland/fourpuzzle/gamestate | |
parent | ed66e0aef4f519052a982dfcd1d454a1699e9800 (diff) | |
download | fourpuzzle-50928c2d12bf145711df877bb86aadfb1306860b.tar.gz fourpuzzle-50928c2d12bf145711df877bb86aadfb1306860b.tar.bz2 fourpuzzle-50928c2d12bf145711df877bb86aadfb1306860b.zip |
Add choice choosing to ChoiceWindow
ChoiceWindow has also been modified around to rely on a Window class which makes the process more elegant (not elegant, just more so than before). TitleScreenGameState has also been modified to close the game when "End" is selected.
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate')
-rwxr-xr-x | src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java | 72 |
1 files changed, 53 insertions, 19 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java b/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java index 2f5dc97..998d33a 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java | |||
@@ -10,6 +10,7 @@ import com.fourisland.fourpuzzle.gamestate.mapview.MapViewGameState; | |||
10 | import com.fourisland.fourpuzzle.transition.SquareTransition; | 10 | import com.fourisland.fourpuzzle.transition.SquareTransition; |
11 | import com.fourisland.fourpuzzle.transition.TransitionDirection; | 11 | import com.fourisland.fourpuzzle.transition.TransitionDirection; |
12 | import com.fourisland.fourpuzzle.util.ObjectLoader; | 12 | import com.fourisland.fourpuzzle.util.ObjectLoader; |
13 | import com.fourisland.fourpuzzle.util.PauseTimer; | ||
13 | import com.fourisland.fourpuzzle.window.ChoiceWindow; | 14 | import com.fourisland.fourpuzzle.window.ChoiceWindow; |
14 | import java.awt.Graphics2D; | 15 | import java.awt.Graphics2D; |
15 | import java.awt.event.KeyEvent; | 16 | import java.awt.event.KeyEvent; |
@@ -38,29 +39,62 @@ public class TitleScreenGameState implements GameState { | |||
38 | Audio.stopMusic(); | 39 | Audio.stopMusic(); |
39 | } | 40 | } |
40 | 41 | ||
42 | PauseTimer pt = new PauseTimer(0); | ||
41 | public void processInput() | 43 | public void processInput() |
42 | { | 44 | { |
43 | if (Game.getKey().getKeyCode() == KeyEvent.VK_ENTER) | 45 | if (pt.isElapsed()) |
44 | { | 46 | { |
45 | Game.setSaveFile(new SaveFile()); | 47 | if (Game.getKey().getKeyCode() == KeyEvent.VK_ENTER) |
46 | 48 | { | |
47 | new Thread(new Runnable() { | 49 | if (choices.getSelected().equals(Database.getVocab("NewGame"))) |
48 | public void run() { | 50 | { |
49 | try { | 51 | Game.setSaveFile(new SaveFile()); |
50 | Display.transition(new SquareTransition(TransitionDirection.Out)); | 52 | |
51 | } catch (InterruptedException ex) { | 53 | new Thread(new Runnable() { |
52 | Thread.currentThread().interrupt(); | 54 | public void run() { |
53 | } | 55 | try { |
54 | 56 | Display.transition(new SquareTransition(TransitionDirection.Out)); | |
55 | Game.setGameState(new MapViewGameState("TestMap", 1, 2)); | 57 | } catch (InterruptedException ex) { |
56 | 58 | Thread.currentThread().interrupt(); | |
57 | try { | 59 | } |
58 | Display.transition(new SquareTransition(TransitionDirection.In)); | 60 | |
59 | } catch (InterruptedException ex) { | 61 | Game.setGameState(new MapViewGameState("TestMap", 1, 2)); |
60 | Thread.currentThread().interrupt(); | 62 | |
61 | } | 63 | try { |
64 | Display.transition(new SquareTransition(TransitionDirection.In)); | ||
65 | } catch (InterruptedException ex) { | ||
66 | Thread.currentThread().interrupt(); | ||
67 | } | ||
68 | } | ||
69 | }).start(); | ||
70 | } else if (choices.getSelected().equals(Database.getVocab("LoadGame"))) | ||
71 | { | ||
72 | // Do nothing, yet | ||
73 | } else if (choices.getSelected().equals(Database.getVocab("EndGame"))) | ||
74 | { | ||
75 | new Thread(new Runnable() { | ||
76 | public void run() { | ||
77 | try { | ||
78 | Display.transition(new SquareTransition(TransitionDirection.Out)); | ||
79 | } catch (InterruptedException ex) { | ||
80 | Thread.currentThread().interrupt(); | ||
81 | } | ||
82 | |||
83 | System.exit(0); | ||
84 | } | ||
85 | }).start(); | ||
62 | } | 86 | } |
63 | }).start(); | 87 | } else if (Game.getKey().getKeyCode() == KeyEvent.VK_UP) |
88 | { | ||
89 | choices.moveUp(); | ||
90 | |||
91 | pt.setTimer(1); | ||
92 | } else if (Game.getKey().getKeyCode() == KeyEvent.VK_DOWN) | ||
93 | { | ||
94 | choices.moveDown(); | ||
95 | |||
96 | pt.setTimer(1); | ||
97 | } | ||
64 | } | 98 | } |
65 | } | 99 | } |
66 | 100 | ||