/** * The joystick index. * * @return joystick index. * * @see com.jme3.input.InputManager#getJoysticks() */ public int getJoyIndex() { return button.getJoystick().getJoyId(); }
@Override public String toString(){ return "JoystickButton[name=" + getName() + ", parent=" + parent.getName() + ", id=" + getButtonId() + ", logicalId=" + getLogicalId() + "]"; } }
/** * Sets custom triggers for zooming in the cam * default is * new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true) mouse wheel up * @param triggers */ public void setZoomInTrigger(Trigger... triggers) { inputManager.deleteMapping(CameraInput.CHASECAM_ZOOMIN); inputManager.addMapping(CameraInput.CHASECAM_ZOOMIN, triggers); inputManager.addListener(this, CameraInput.CHASECAM_ZOOMIN); }
@Override public Object jmeClone() { ChaseCamera cc = new ChaseCamera(cam, inputManager); cc.target = target; cc.setMaxDistance(getMaxDistance()); cc.setMinDistance(getMinDistance()); return cc; }
private void setupChaseCamera() { flyCam.setEnabled(false); chaseCam = new ChaseCamera(cam, model, inputManager); }
/** * Gets the index number for the X axis on the joystick. * * <p>E.g. for most gamepads, the left control stick X axis will be returned. * * @return The axis index for the X axis for this joystick. * * @see Joystick#assignAxis(java.lang.String, java.lang.String, int) */ @Override public int getXAxisIndex(){ return getXAxis().getAxisId(); }
/** * Gets the index number for the Y axis on the joystick. * * <p>E.g. for most gamepads, the left control stick Y axis will be returned. * * @return The axis index for the Y axis for this joystick. * * @see Joystick#assignAxis(java.lang.String, java.lang.String, int) */ @Override public int getYAxisIndex(){ return getYAxis().getAxisId(); }
/** * The joystick index. * * @return joystick index. * * @see InputManager#getJoysticks() */ public int getJoyIndex() { return axis.getJoystick().getJoyId(); }
/** * @param dragToRotate When true, the user must hold the mouse button * and drag over the screen to rotate the camera, and the cursor is * visible until dragged. Otherwise, the cursor is invisible at all times * and holding the mouse button is not needed to rotate the camera. * This feature is disabled by default. */ public void setDragToRotate(boolean dragToRotate) { this.dragToRotate = dragToRotate; this.canRotate = !dragToRotate; inputManager.setCursorVisible(dragToRotate); }
@Override public int getYAxisIndex() { return povAxisY.getAxisId(); } }
/** * The button index. * * @return button index. * * @see Joystick#assignButton(java.lang.String, int) */ public int getButtonIndex() { return button.getButtonId(); }
/** * Sets the min zoom distance of the camera (default is 1) */ public void setMinDistance(float minDistance) { this.minDistance = minDistance; if (minDistance > distance) { zoomCamera(distance - minDistance); } }
/** * update the camera control, should only be used internally * @param tpf */ public void update(float tpf) { updateCamera(tpf); }
/** * Rumbles the joystick for the given amount/magnitude. * * @param amount The amount to rumble. Should be between 0 and 1. */ @Override public void rumble(float amount){ joyInput.setJoyRumble(joyId, amount); }
/** * Enable simulation of mouse events. Used for touchscreen input only. * * @param value True to enable simulation of mouse events */ public void setSimulateMouse(boolean value) { if (touch != null) { touch.setSimulateMouse(value); } } /**
public void addAxis(final int index, final JoystickAxis axis) { super.addAxis(axis); if (index == 0) { povAxisX = axis; } else if (index == 1) { povAxisY = axis; } }
/** * Sets custom triggers for toggling the rotation of the cam * default are * new MouseButtonTrigger(MouseInput.BUTTON_LEFT) left mouse button * new MouseButtonTrigger(MouseInput.BUTTON_RIGHT) right mouse button * @param triggers */ public void setToggleRotationTrigger(Trigger... triggers) { inputManager.deleteMapping(CameraInput.CHASECAM_TOGGLEROTATE); inputManager.addMapping(CameraInput.CHASECAM_TOGGLEROTATE, triggers); inputManager.addListener(this, CameraInput.CHASECAM_TOGGLEROTATE); }
/** * Sets custom triggers for zooming out the cam * default is * new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false) mouse wheel down * @param triggers */ public void setZoomOutTrigger(Trigger... triggers) { inputManager.deleteMapping(CameraInput.CHASECAM_ZOOMOUT); inputManager.addMapping(CameraInput.CHASECAM_ZOOMOUT, triggers); inputManager.addListener(this, CameraInput.CHASECAM_ZOOMOUT); }