Class InputFilteredAction

java.lang.Object
com.blackrook.gui.action.InputFilteredAction
All Implemented Interfaces:
GUIAction

public class InputFilteredAction extends Object implements GUIAction
An action that validates HOW it was activated before it is actually called. This is meant to be attached to more than one type of event, especially if mouse, gamepad, and keyboard keys are used for validation.
Author:
Matthew Tropiano
  • Method Details

    • create

      public static InputFilteredAction create(GUIAction action)
      Creates a new input-filtered action.
      Parameters:
      action - the action to call after the input is validated.
      Returns:
      a new filtered action.
    • axisTap

      public static InputFilteredAction.AxisTap axisTap(int axisId, boolean positive)
      Creates a new axis tap.
      Parameters:
      axisId - the axis id.
      positive - true if positive axis direction, false if negative.
      Returns:
      a new axis tap.
    • setCodes

      public InputFilteredAction setCodes(int... codes)
      Adds a "valid" generic code to this action. Codes are user defined and can be anything.
      Parameters:
      codes - the generic codes to add.
      Returns:
      itself, for call chaining.
    • setKeyCodes

      public InputFilteredAction setKeyCodes(int... keyCodes)
      Adds a "valid" key code to this action. Key codes are defined by the ones in GUIInputConstants.
      Parameters:
      keyCodes - the key codes to add.
      Returns:
      itself, for call chaining.
    • setMouseButtons

      public InputFilteredAction setMouseButtons(int... buttons)
      Adds a "valid" mouse button to this action. Mouse buttons are defined by the ones in GUIInputConstants.
      Parameters:
      buttons - the mouse buttons to add.
      Returns:
      itself, for call chaining.
    • setGamepadButtons

      public InputFilteredAction setGamepadButtons(int... buttons)
      Adds a "valid" gamepad button to this action. Gamepad buttons are defined by the ones in GUIInputConstants. the equivalents in GUIInputConstants.
      Parameters:
      buttons - the gamepad buttons to add.
      Returns:
      itself, for call chaining.
    • setGamepadAxisTaps

      public InputFilteredAction setGamepadAxisTaps(InputFilteredAction.AxisTap... axisTaps)
      Adds a "valid" gamepad axis tap to this action. Gamepad axes are defined by the ones in GUIInputConstants. the equivalents in GUIInputConstants.
      Parameters:
      axisTaps - the axis taps to set.
      Returns:
      itself, for call chaining.
    • call

      public final void call(GUIEvent event)
      Description copied from interface: GUIAction
      The method stub called when this action is invoked.
      Specified by:
      call in interface GUIAction
      Parameters:
      event - the event that was passed into this action.