@Override public int getYAxisIndex() { return povAxisY.getAxisId(); } }
@Override public int getXAxisIndex() { return povAxisX.getAxisId(); }
@Override public int getXAxisIndex(){ return xAxis.getAxisId(); }
/** * Returns the joystick axis index. * * @return joystick axis index. * * @see Joystick#assignAxis(java.lang.String, java.lang.String, int) */ public int getAxisIndex() { return axis.getAxisId(); }
@Override public int getYAxisIndex(){ return yAxis.getAxisId(); } }
@Override public int getYAxisIndex(){ return yAxis.getAxisId(); } }
@Override public int getXAxisIndex(){ return xAxis.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(); }
/** * 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(); }
@Override public void update() { for (final Map.Entry<Integer, GlfwJoystick> entry : joysticks.entrySet()) { // Axes final FloatBuffer axisValues = glfwGetJoystickAxes(entry.getKey()); for (final JoystickAxis axis : entry.getValue().getAxes()) { final float value = axisValues.get(axis.getAxisId()); listener.onJoyAxisEvent(new JoyAxisEvent(axis, value)); } // Buttons final ByteBuffer byteBuffer = glfwGetJoystickButtons(entry.getKey()); for (final JoystickButton button : entry.getValue().getButtons()) { final boolean pressed = byteBuffer.get(button.getButtonId()) == GLFW_PRESS; if (joyButtonPressed.get(button) != pressed) { joyButtonPressed.put(button, pressed); listener.onJoyButtonEvent(new JoyButtonEvent(button, pressed)); } } } }
/** * Assign the mappings to receive events from the given joystick axis. * * @param positiveMapping The mapping to receive events when the axis is negative * @param negativeMapping The mapping to receive events when the axis is positive * @param axisId The axis index. * * @see Joystick#getAxisCount() * @deprecated Use JoystickAxis.assignAxis() instead. */ @Override public void assignAxis(String positiveMapping, String negativeMapping, int axisId){ // For backwards compatibility if( axisId == JoyInput.AXIS_POV_X ) { axisId = getPovXAxis().getAxisId(); } else if( axisId == JoyInput.AXIS_POV_Y ) { axisId = getPovYAxis().getAxisId(); } inputManager.addMapping(positiveMapping, new JoyAxisTrigger(joyId, axisId, false)); inputManager.addMapping(negativeMapping, new JoyAxisTrigger(joyId, axisId, true)); }
@Override public int getYAxisIndex() { return povAxisY.getAxisId(); } }
@Override public int getXAxisIndex() { return povAxisX.getAxisId(); }
/** * Returns the joystick axis index. * * @return joystick axis index. * * @see Joystick#assignAxis(java.lang.String, java.lang.String, int) */ public int getAxisIndex() { return axis.getAxisId(); }
@Override public int getYAxisIndex(){ return yAxis.getAxisId(); } }
@Override public int getXAxisIndex(){ return xAxis.getAxisId(); }
/** * 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(); }
public void update() { for (final Map.Entry<Integer, GlfwJoystick> entry : joysticks.entrySet()) { // Axes final FloatBuffer axisValues = glfwGetJoystickAxes(entry.getKey()); for (final JoystickAxis axis : entry.getValue().getAxes()) { final float value = axisValues.get(axis.getAxisId()); listener.onJoyAxisEvent(new JoyAxisEvent(axis, value)); } // Buttons final ByteBuffer byteBuffer = glfwGetJoystickButtons(entry.getKey()); for (final JoystickButton button : entry.getValue().getButtons()) { final boolean pressed = byteBuffer.get(button.getButtonId()) == GLFW_PRESS; listener.onJoyButtonEvent(new JoyButtonEvent(button, pressed)); } } }
/** * Assign the mappings to receive events from the given joystick axis. * * @param positiveMapping The mapping to receive events when the axis is negative * @param negativeMapping The mapping to receive events when the axis is positive * @param axisId The axis index. * * @see Joystick#getAxisCount() * @deprecated Use JoystickAxis.assignAxis() instead. */ @Override public void assignAxis(String positiveMapping, String negativeMapping, int axisId){ // For backwards compatibility if( axisId == JoyInput.AXIS_POV_X ) { axisId = getPovXAxis().getAxisId(); } else if( axisId == JoyInput.AXIS_POV_Y ) { axisId = getPovYAxis().getAxisId(); } inputManager.addMapping(positiveMapping, new JoyAxisTrigger(joyId, axisId, false)); inputManager.addMapping(negativeMapping, new JoyAxisTrigger(joyId, axisId, true)); }