Android: Remove Escape key mapping from InputManager (defined in SimpleApplication) when using Android platforms.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10898 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
iwg..ic 11 years ago
parent 9ed99ce21f
commit 9e8abfb6ec
  1. 7
      engine/src/android/com/jme3/app/AndroidHarness.java

@ -530,6 +530,13 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt
public void initialize() { public void initialize() {
app.initialize(); app.initialize();
if (handleExitHook) { if (handleExitHook) {
// remove existing mapping from SimpleApplication that stops the app
// when the esc key is pressed (esc key = android back key) so that
// AndroidHarness can produce the exit app dialog box.
if (app.getInputManager().hasMapping(SimpleApplication.INPUT_MAPPING_EXIT)) {
app.getInputManager().deleteMapping(SimpleApplication.INPUT_MAPPING_EXIT);
}
app.getInputManager().addMapping(ESCAPE_EVENT, new TouchTrigger(TouchInput.KEYCODE_BACK)); app.getInputManager().addMapping(ESCAPE_EVENT, new TouchTrigger(TouchInput.KEYCODE_BACK));
app.getInputManager().addListener(this, new String[]{ESCAPE_EVENT}); app.getInputManager().addListener(this, new String[]{ESCAPE_EVENT});
} }

Loading…
Cancel
Save