Search in sources :

Example 11 with Joystick

use of com.jme3.input.Joystick in project jmonkeyengine by jMonkeyEngine.

the class TestJoystick method setViewedJoystick.

protected void setViewedJoystick(Joystick stick) {
    if (this.viewedJoystick == stick)
        return;
    if (this.viewedJoystick != null) {
        joystickInfo.detachAllChildren();
    }
    this.viewedJoystick = stick;
    if (this.viewedJoystick != null) {
        // Draw the hud
        yInfo = 0;
        addInfo("Joystick:\"" + stick.getName() + "\"  id:" + stick.getJoyId(), 0);
        yInfo -= 5;
        float ySave = yInfo;
        // Column one for the buttons
        addInfo("Buttons:", 0);
        for (JoystickButton b : stick.getButtons()) {
            addInfo(" '" + b.getName() + "' id:'" + b.getLogicalId() + "'", 0);
        }
        yInfo = ySave;
        // Column two for the axes
        addInfo("Axes:", 1);
        for (JoystickAxis a : stick.getAxes()) {
            addInfo(" '" + a.getName() + "' id:'" + a.getLogicalId() + "' analog:" + a.isAnalog(), 1);
        }
    }
}
Also used : JoystickButton(com.jme3.input.JoystickButton) JoystickAxis(com.jme3.input.JoystickAxis)

Example 12 with Joystick

use of com.jme3.input.Joystick in project jmonkeyengine by jMonkeyEngine.

the class VRApplication method initInput.

/**
     * Initializes mouse and keyboard input. Also
     * initializes joystick input if joysticks are enabled in the
     * AppSettings.
     */
private void initInput() {
    mouseInput = context.getMouseInput();
    if (mouseInput != null)
        mouseInput.initialize();
    keyInput = context.getKeyInput();
    if (keyInput != null)
        keyInput.initialize();
    touchInput = context.getTouchInput();
    if (touchInput != null)
        touchInput.initialize();
    if (!settings.getBoolean("DisableJoysticks")) {
        joyInput = context.getJoyInput();
        if (joyInput != null)
            joyInput.initialize();
    }
    inputManager = new InputManager(mouseInput, keyInput, joyInput, touchInput);
}
Also used : InputManager(com.jme3.input.InputManager)

Aggregations

JoystickAxis (com.jme3.input.JoystickAxis)7 Joystick (com.jme3.input.Joystick)6 JoystickButton (com.jme3.input.JoystickButton)4 SensorJoystickAxis (com.jme3.input.SensorJoystickAxis)3 DefaultJoystickAxis (com.jme3.input.DefaultJoystickAxis)2 DefaultJoystickButton (com.jme3.input.DefaultJoystickButton)2 JoyAxisTrigger (com.jme3.input.controls.JoyAxisTrigger)2 MouseButtonTrigger (com.jme3.input.controls.MouseButtonTrigger)2 IntMap (com.jme3.util.IntMap)2 InputDevice (android.view.InputDevice)1 MotionRange (android.view.InputDevice.MotionRange)1 AbstractJoystick (com.jme3.input.AbstractJoystick)1 InputManager (com.jme3.input.InputManager)1 ActionListener (com.jme3.input.controls.ActionListener)1 JoyAxisEvent (com.jme3.input.event.JoyAxisEvent)1 JoyButtonEvent (com.jme3.input.event.JoyButtonEvent)1 Material (com.jme3.material.Material)1 Geometry (com.jme3.scene.Geometry)1 Mesh (com.jme3.scene.Mesh)1 Node (com.jme3.scene.Node)1