|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
com.jme3.input
package is used for all input handling in
jMonkeyEngine.
See:
Description
Interface Summary | |
---|---|
Input | Abstract interface for an input device. |
JoyInput | A specific API for interfacing with joysticks or gaming controllers. |
KeyInput | A specific API for interfacing with the keyboard. |
MouseInput | A specific API for interfacing with the mouse. |
RawInputListener | An interface used for receiving raw input from devices. |
SoftTextDialogInput | |
TouchInput | A specific API for interfacing with smartphone touch devices |
Class Summary | |
---|---|
ChaseCamera | A camera that follows a spatial and can turn around it by dragging the mouse |
FlyByCamera | A first person view camera controller. |
InputManager | The InputManager is responsible for converting input events
received from the Key, Mouse and Joy Input implementations into an
abstract, input device independent representation that user code can use. |
Joystick | A joystick represents a single joystick that is installed in the system. |
KeyNames |
The com.jme3.input
package is used for all input handling in
jMonkeyEngine. User code should use the InputManager
to register
for and receive input events. The InputManager
can be
retrieved for an application by using Application.getInputManager()
.
Using ActionListener:
// Retrieve an input manager for the application "app"
InputManager inputManager = app.getInputManager();
// Adds a new mapping "PrintHello" that will be invoked when the Return/Enter key is pressed
inputManager.addMapping("PrintHello", new KeyTrigger(KeyInput.KEY_RETURN));
// Adds a new ActionListener to get an event when enter is pressed.
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
// Only invoke the event when the mapping is "PrintHello"
// and isPressed is true, meaning it was a key press and not release.
if (name.equals("PrintHello") && isPressed){
System.out.println("Hello!");
}
}
}, "PrintHello");
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |