diff --git a/src/mightypork/rogue/RogueKeys.java b/src/mightypork/rogue/RogueKeys.java index 67bbfe6..b17dfda 100644 --- a/src/mightypork/rogue/RogueKeys.java +++ b/src/mightypork/rogue/RogueKeys.java @@ -15,10 +15,24 @@ public class RogueKeys implements Config.KeySetup { keys.add("global.menu", "CTRL+M"); keys.add("global.screenshot", "F2"); keys.add("global.fullscreen", "F11"); + keys.add("global.fps_meter", "F3"); + + keys.add("general.back", "ESC"); // leave a dialog / screen + keys.add("general.cancel", "ESC"); // cancel operation + keys.add("general.confirm", "ENTER"); // confirm default option + keys.add("general.yes", "Y"); // answer YES + keys.add("general.no", "N"); // answer NO - keys.add("general.cancel", "ESC"); - keys.add("general.confirm", "ENTER"); - keys.add("general.yes", "Y"); - keys.add("general.no", "N"); + keys.add("game.quit", "ESC"); + keys.add("game.save", "CTRL+S"); + keys.add("game.load", "CTRL+L"); + keys.add("game.zoom", "Z"); + keys.add("game.minimap", "M"); + keys.add("game.eat", "E"); + keys.add("game.drop", "D"); + keys.add("game.inventory", "I"); + keys.add("game.pause", "P"); + keys.add("game.pause2", "SPACE"); + keys.add("game.cheat.xray", "CTRL+SHIFT+X"); } } diff --git a/src/mightypork/rogue/screens/FpsOverlay.java b/src/mightypork/rogue/screens/FpsOverlay.java index 4f07702..133915c 100644 --- a/src/mightypork/rogue/screens/FpsOverlay.java +++ b/src/mightypork/rogue/screens/FpsOverlay.java @@ -1,6 +1,7 @@ package mightypork.rogue.screens; +import mightypork.gamecore.Config; import mightypork.gamecore.core.AppAccess; import mightypork.gamecore.gui.Action; import mightypork.gamecore.gui.AlignX; @@ -35,7 +36,7 @@ public class FpsOverlay extends Overlay { /* * Toggle key: F3 */ - bindKey(new KeyStroke(Keys.F3), Edge.RISING, new Action() { + bindKey(Config.getKey("global.fps_meter"), Edge.RISING, new Action() { @Override public void execute() diff --git a/src/mightypork/rogue/screens/game/AskSaveLayer.java b/src/mightypork/rogue/screens/game/AskSaveLayer.java index ebfdf2c..8aecb68 100644 --- a/src/mightypork/rogue/screens/game/AskSaveLayer.java +++ b/src/mightypork/rogue/screens/game/AskSaveLayer.java @@ -3,6 +3,7 @@ package mightypork.rogue.screens.game; import java.io.IOException; +import mightypork.gamecore.Config; import mightypork.gamecore.gui.Action; import mightypork.gamecore.gui.AlignX; import mightypork.gamecore.gui.components.input.TextButton; @@ -103,7 +104,7 @@ public class AskSaveLayer extends ScreenLayer { } }; - btn1.setAction(new Action() { + final Action save = new Action() { @Override protected void execute() @@ -115,20 +116,28 @@ public class AskSaveLayer extends ScreenLayer { Log.e(e); } } - }); + }; - btn2.setAction(new Action() { + final Action discard = new Action() { @Override protected void execute() { if (task != null) task.run(); } - }); + }; + btn1.setAction(save); + btn2.setAction(discard); btn3.setAction(cancel); - bindKey(new KeyStroke(Keys.ESCAPE), Edge.RISING, cancel); + bindKey(Config.getKey("general.back"), Edge.RISING, cancel); + bindKey(Config.getKey("general.cancel"), Edge.RISING, cancel); + + bindKey(Config.getKey("general.yes"), Edge.RISING, save); + bindKey(Config.getKey("general.confirm"), Edge.RISING, save); + + bindKey(Config.getKey("general.no"), Edge.RISING, discard); updated.add(numa); updated.add(hideTT); diff --git a/src/mightypork/rogue/screens/game/ScreenGame.java b/src/mightypork/rogue/screens/game/ScreenGame.java index 03aea5f..220c1d2 100644 --- a/src/mightypork/rogue/screens/game/ScreenGame.java +++ b/src/mightypork/rogue/screens/game/ScreenGame.java @@ -3,6 +3,7 @@ package mightypork.rogue.screens.game; import java.io.File; +import mightypork.gamecore.Config; import mightypork.gamecore.core.AppAccess; import mightypork.gamecore.core.events.UserQuitRequest; import mightypork.gamecore.gui.Action; @@ -242,19 +243,18 @@ public class ScreenGame extends RogueScreen implements PlayerDeathHandler { addLayer(askSaveLayer = new AskSaveLayer(this)); //pause key - bindKey(new KeyStroke(Keys.P), Edge.RISING, actionTogglePause); - bindKey(new KeyStroke(Keys.PAUSE), Edge.RISING, actionTogglePause); - bindKey(new KeyStroke(Keys.SPACE), Edge.RISING, actionTogglePause); + bindKey(Config.getKey("game.pause2"), Edge.RISING, actionTogglePause); + bindKey(Config.getKey("game.pause"), Edge.RISING, actionTogglePause); - bindKey(new KeyStroke(Keys.I), Edge.RISING, actionToggleInv); - bindKey(new KeyStroke(Keys.D), Edge.RISING, actionDropLastPickedItem); - bindKey(new KeyStroke(Keys.E), Edge.RISING, actionEat); - bindKey(new KeyStroke(Keys.M), Edge.RISING, actionToggleMinimap); - bindKey(new KeyStroke(Keys.Z), Edge.RISING, actionToggleZoom); + bindKey(Config.getKey("game.inventory"), Edge.RISING, actionToggleInv); + bindKey(Config.getKey("game.drop"), Edge.RISING, actionDropLastPickedItem); + bindKey(Config.getKey("game.eat"), Edge.RISING, actionEat); + bindKey(Config.getKey("game.minimap"), Edge.RISING, actionToggleMinimap); + bindKey(Config.getKey("game.zoom"), Edge.RISING, actionToggleZoom); - bindKey(new KeyStroke(Keys.L, Keys.MOD_CONTROL), Edge.RISING, actionLoad); - bindKey(new KeyStroke(Keys.S, Keys.MOD_CONTROL), Edge.RISING, actionSave); - bindKey(new KeyStroke(Keys.ESCAPE), Edge.RISING, actionMenu); + bindKey(Config.getKey("game.load"), Edge.RISING, actionLoad); + bindKey(Config.getKey("game.save"), Edge.RISING, actionSave); + bindKey(Config.getKey("game.quit"), Edge.RISING, actionMenu); // add as actions - enableables. worldActions.add(worldLayer); @@ -274,7 +274,7 @@ public class ScreenGame extends RogueScreen implements PlayerDeathHandler { worldActions.setEnabled(true); // CHEAT - X-ray - bindKey(new KeyStroke(Keys.NUMPAD_MULTIPLY, Keys.MOD_CONTROL), Edge.RISING, new Runnable() { + bindKey(Config.getKey("game.cheat.xray"), Edge.RISING, new Runnable() { @Override public void run() diff --git a/src/mightypork/rogue/screens/menu/ScreenMainMenu.java b/src/mightypork/rogue/screens/menu/ScreenMainMenu.java index 254b4f2..a7c26d6 100644 --- a/src/mightypork/rogue/screens/menu/ScreenMainMenu.java +++ b/src/mightypork/rogue/screens/menu/ScreenMainMenu.java @@ -1,7 +1,9 @@ package mightypork.rogue.screens.menu; +import mightypork.gamecore.Config; import mightypork.gamecore.core.AppAccess; +import mightypork.gamecore.core.events.UserQuitRequest; import mightypork.gamecore.gui.Action; import mightypork.gamecore.gui.AlignX; import mightypork.gamecore.gui.components.input.TextButton; @@ -113,18 +115,18 @@ public class ScreenMainMenu extends RogueScreen { @Override protected void execute() { - getEventBus().send(new RogueStateRequest(RogueState.EXIT)); + getEventBus().send(new UserQuitRequest()); } }); rows.add(btn, 2); - bindKey(new KeyStroke(Keys.ESCAPE), Edge.RISING, new Runnable() { + bindKey(Config.getKey("general.back"), Edge.RISING, new Runnable() { @Override public void run() { - getEventBus().send(new RogueStateRequest(RogueState.EXIT)); + getEventBus().send(new UserQuitRequest()); } }); } diff --git a/src/mightypork/rogue/screens/select_world/ScreenSelectWorld.java b/src/mightypork/rogue/screens/select_world/ScreenSelectWorld.java index 36c555e..ffdebbe 100644 --- a/src/mightypork/rogue/screens/select_world/ScreenSelectWorld.java +++ b/src/mightypork/rogue/screens/select_world/ScreenSelectWorld.java @@ -1,6 +1,7 @@ package mightypork.rogue.screens.select_world; +import mightypork.gamecore.Config; import mightypork.gamecore.WorkDir; import mightypork.gamecore.core.AppAccess; import mightypork.gamecore.gui.AlignX; @@ -83,7 +84,7 @@ public class ScreenSelectWorld extends RogueScreen { rows.add(slot3); // escape to quitn from here - bindKey(new KeyStroke(Keys.ESCAPE), Edge.RISING, new Runnable() { + bindKey(Config.getKey("general.back"), Edge.RISING, new Runnable() { @Override public void run() @@ -91,15 +92,6 @@ public class ScreenSelectWorld extends RogueScreen { getEventBus().send(new RogueStateRequest(RogueState.MAIN_MENU)); } }); - - bindKey(new KeyStroke(Keys.Q, Keys.MOD_CONTROL), Edge.RISING, new Runnable() { - - @Override - public void run() - { - getEventBus().send(new RogueStateRequest(RogueState.EXIT)); - } - }); }