com.jme3.input
package is used for all input handling in
jMonkeyEngine.See: Description
Interface | Description |
---|---|
Input |
Abstract interface for an input device.
|
JoyInput |
A specific API for interfacing with joysticks or gaming controllers.
|
Joystick |
A joystick represents a single joystick that is installed in the system.
|
JoystickAxis |
Represents a single axis of a Joystick.
|
JoystickButton |
Represents a single button of a Joystick.
|
JoystickConnectionListener |
Listens for the state of a joystick connection.
|
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.
|
SensorJoystickAxis |
Represents a joystick axis based on an external sensor
(i.e.
|
SoftTextDialogInput | |
TouchInput |
A specific API for interfacing with smartphone touch devices
|
Class | Description |
---|---|
AbstractJoystick |
A joystick represents a single joystick that is installed in the system.
|
AWTInput |
The implementation of the
Input dedicated to AWT component . |
AWTKeyInput |
The implementation of the
KeyInput dedicated to AWT component . |
AWTMouseInput |
The implementation of the
MouseInput dedicated to AWT component . |
CameraInput |
This class defines all the constants used in camera handlers for registration
with the inputManager
|
ChaseCamera |
A camera that follows a spatial and can turn around it by dragging the mouse
|
DefaultJoystickAxis |
Default implementation of the JoystickAxis interface.
|
DefaultJoystickButton |
Default implementation of the JoystickButton interface.
|
FlyByCamera |
A first-person 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. |
JoystickCompatibilityMappings |
Provides compatibility mapping to different joysticks
that both report their name in a unique way and require
remapping to achieve a proper default layout.
|
KeyNames |
Translate key codes (from
KeyInput ) to descriptive names. |
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");