summary refs log tree commit diff stats
path: root/src/com/fourisland
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-02-16 12:38:08 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-02-16 12:38:08 -0500
commit1db6402b9171fc13b377b01d49531659a4e1fc76 (patch)
tree7bbf06df73b0b0f5c232ead87ba72c6cd3405799 /src/com/fourisland
parent6b188d5f1415c69cc62fcbd853802f279fcd690d (diff)
downloadfourpuzzle-1db6402b9171fc13b377b01d49531659a4e1fc76.tar.gz
fourpuzzle-1db6402b9171fc13b377b01d49531659a4e1fc76.tar.bz2
fourpuzzle-1db6402b9171fc13b377b01d49531659a4e1fc76.zip
Engine: Abstracted action key
Because some people prefer to use the space bar as the action key rather than the enter key, KeyInput now has a method that checks if either is down. Action key requiring conditions use this now instead of manually checking the key.
Diffstat (limited to 'src/com/fourisland')
-rw-r--r--src/com/fourisland/fourpuzzle/KeyInput.java5
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java3
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java2
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java2
-rw-r--r--src/com/fourisland/fourpuzzle/window/MessageWindow.java3
5 files changed, 9 insertions, 6 deletions
diff --git a/src/com/fourisland/fourpuzzle/KeyInput.java b/src/com/fourisland/fourpuzzle/KeyInput.java index 37eda77..910eea9 100644 --- a/src/com/fourisland/fourpuzzle/KeyInput.java +++ b/src/com/fourisland/fourpuzzle/KeyInput.java
@@ -57,4 +57,9 @@ public class KeyInput
57 { 57 {
58 return key; 58 return key;
59 } 59 }
60
61 public boolean isActionDown()
62 {
63 return ((key == KeyEvent.VK_ENTER) || (key == KeyEvent.VK_SPACE));
64 }
60} \ No newline at end of file 65} \ No newline at end of file
diff --git a/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java b/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java index d9b9ea1..e87f80a 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java
@@ -15,7 +15,6 @@ import com.fourisland.fourpuzzle.database.Music;
15import com.fourisland.fourpuzzle.database.Transitions; 15import com.fourisland.fourpuzzle.database.Transitions;
16import com.fourisland.fourpuzzle.util.ObjectLoader; 16import com.fourisland.fourpuzzle.util.ObjectLoader;
17import java.awt.Graphics2D; 17import java.awt.Graphics2D;
18import java.awt.event.KeyEvent;
19 18
20/** 19/**
21 * 20 *
@@ -35,7 +34,7 @@ public class GameOverGameState implements GameState {
35 34
36 public void processInput(KeyInput key) 35 public void processInput(KeyInput key)
37 { 36 {
38 if ((key.getKey() == KeyEvent.VK_ENTER) || (key.getKey() == KeyEvent.VK_SPACE)) 37 if (key.isActionDown())
39 { 38 {
40 Game.setSaveFile(new SaveFile()); 39 Game.setSaveFile(new SaveFile());
41 40
diff --git a/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java b/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java index 432d245..d40b3f9 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java
@@ -48,7 +48,7 @@ public class TitleScreenGameState implements GameState {
48 { 48 {
49 if (pt.isElapsed()) 49 if (pt.isElapsed())
50 { 50 {
51 if (key.getKey() == KeyEvent.VK_ENTER) 51 if (key.isActionDown())
52 { 52 {
53 Audio.playSound(Database.getSound(Sound.Selection)); 53 Audio.playSound(Database.getSound(Sound.Selection));
54 54
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java index 1213b0c..68e611b 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
@@ -120,7 +120,7 @@ public class MapViewGameState implements GameState {
120 } 120 }
121 } 121 }
122 122
123 if ((key.getKey() == KeyEvent.VK_ENTER) || (key.getKey() == KeyEvent.VK_SPACE)) 123 if (key.isActionDown())
124 { 124 {
125 for (LayerEvent ev : currentMap.getEvents()) 125 for (LayerEvent ev : currentMap.getEvents())
126 { 126 {
diff --git a/src/com/fourisland/fourpuzzle/window/MessageWindow.java b/src/com/fourisland/fourpuzzle/window/MessageWindow.java index 413805d..0057ca3 100644 --- a/src/com/fourisland/fourpuzzle/window/MessageWindow.java +++ b/src/com/fourisland/fourpuzzle/window/MessageWindow.java
@@ -16,7 +16,6 @@ import com.fourisland.fourpuzzle.util.Renderable;
16import java.awt.Graphics2D; 16import java.awt.Graphics2D;
17import java.awt.Rectangle; 17import java.awt.Rectangle;
18import java.awt.TexturePaint; 18import java.awt.TexturePaint;
19import java.awt.event.KeyEvent;
20import java.awt.image.BufferedImage; 19import java.awt.image.BufferedImage;
21import java.util.ArrayList; 20import java.util.ArrayList;
22import java.util.List; 21import java.util.List;
@@ -65,7 +64,7 @@ public class MessageWindow implements Renderable {
65 Inputable in = new Inputable() { 64 Inputable in = new Inputable() {
66 public void processInput(KeyInput key) 65 public void processInput(KeyInput key)
67 { 66 {
68 if ((key.getKey() == KeyEvent.VK_ENTER) || (key.getKey() == KeyEvent.VK_SPACE)) 67 if (key.isActionDown())
69 { 68 {
70 if (mw.pushEnter()) 69 if (mw.pushEnter())
71 { 70 {