Removing ESC key to exit?

How can I remove ESC key?



Regards, Gustavo Borba.

I framed this thread in gold.

With a knife or some other thin, hard tool you should be able to get between the Esc and F1 key and then bring leverage to the Esc key so that it will pop out of your keyboard.

15 Likes

OPkay, normen stop joking please, I'm not good with words, you know what I mean. How to remove the action of "Exit" from ESC key on jME. Like, when

Aaaaah :smiley: KeyBindingManager.getKeyBindingManager().remove("exit"); :stuck_out_tongue:

2 Likes
GustavoBorba said:

How can I remove ESC key?

Regards, Gustavo Borba.
normen said:

With a knife or some other thin, hard tool you should be able to get between the Esc and F1 key and then bring leverage to the Esc key so that it will pop out of your keyboard.

+1 normen +1



http://answers.yahoo.com/question/index?qid=20091106213404AAFwpzO
@normen said:
Aaaaah :D KeyBindingManager.getKeyBindingManager().remove("exit");


Does this work anymore? Where is it descended from?

This thread is ancient and no longer valid, I guess. In jme3 it’s something like inputManager.deleteMapping( name )… where in this case name is one of the constants defined on SimpleApplication:

http://hub.jmonkeyengine.org/javadoc/com/jme3/app/SimpleApplication.html

Something like this (replaces default handling with whatever you like):



[java]

// replace default handling of ESC key

inputManager.deleteMapping(SimpleApplication.INPUT_MAPPING_EXIT);

inputManager.addMapping("Pause", new KeyTrigger(KeyInput.KEY_ESCAPE), new KeyTrigger(KeyInput.KEY_P), new KeyTrigger(KeyInput.KEY_PAUSE));

inputManager.addListener(myCustomKeyActionListener, "Pause");

[/java]

4 Likes

That’s what I’m looking for. Thanks for the code!

Thanks @philotomy

Still works perfectly in 2014.

in SimpleApplication class there is:
public static final String INPUT_MAPPING_EXIT = "SIMPLEAPP_Exit";
so you can use it to delete mapping …
app.getInputManager().deleteMapping("SIMPLEAPP_Exit");
and put your custom action like pause game for ESC key…
and when you need to exit the game just call app.stop()

public class ClientApplication extends SimpleApplication {

	@Override
	public void simpleInitApp() {
		inputManager.deleteMapping(INPUT_MAPPING_EXIT);
	}

}

one line is enough

Mmmm… resurrecting a 6 year old thread to post information already in the thread is not a good look.

Are you a real person?