public void addAxis(final int index, final JoystickAxis axis) { super.addAxis(axis); if (index == 0) { povAxisX = axis; } else if (index == 1) { povAxisY = axis; } }
@Override protected void addButton(final JoystickButton button) { super.addButton(button); }
@Override public String toString(){ return "Joystick[name=" + name + ", id=" + joyId + ", buttons=" + getButtonCount() + ", axes=" + getAxisCount() + "]"; } }
/** * 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)); }
/** * Assign the mapping name to receive events from the given button index * on the joystick. * * @param mappingName The mapping to receive joystick button events. * @param buttonId The button index. * * @see Joystick#getButtonCount() * @deprecated Use JoystickButton.assignButton() instead. */ @Override public void assignButton(String mappingName, int buttonId){ if (buttonId < 0 || buttonId >= getButtonCount()) throw new IllegalArgumentException(); inputManager.addMapping(mappingName, new JoyButtonTrigger(joyId, buttonId)); }
/** * 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(); }
/** * 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)); }
/** * Assign the mapping name to receive events from the given button index * on the joystick. * * @param mappingName The mapping to receive joystick button events. * @param buttonId The button index. * * @see Joystick#getButtonCount() * @deprecated Use JoystickButton.assignButton() instead. */ @Override public void assignButton(String mappingName, int buttonId){ if (buttonId < 0 || buttonId >= getButtonCount()) throw new IllegalArgumentException(); inputManager.addMapping(mappingName, new JoyButtonTrigger(joyId, buttonId)); }
/** * 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 String toString(){ return "Joystick[name=" + name + ", id=" + joyId + ", buttons=" + getButtonCount() + ", axes=" + getAxisCount() + "]"; } }
protected AndroidSensorJoystickAxis addAxis(String axisName, String logicalName, int axisNum, float maxRawValue) { AndroidSensorJoystickAxis axis; axis = new AndroidSensorJoystickAxis( getInputManager(), // InputManager (InputManager) this, // parent Joystick (Joystick) axisNum, // Axis Index (int) axisName, // Axis Name (String) logicalName, // Logical ID (String) true, // isAnalog (boolean) false, // isRelative (boolean) 0.01f, // Axis Deadzone (float) maxRawValue); // Axis Max Raw Value (float) super.addAxis(axis); return axis; }
@Override protected void addButton(JoystickButton button) { super.addButton(button); }
public void addAxis(final int index, final JoystickAxis axis) { super.addAxis(axis); if (index == 0) { povAxisX = axis; } else if (index == 1) { povAxisY = axis; } }