Interface Controller

  • All Known Implementing Classes:
    ControllerAdapter

    public interface Controller
    A game controller of some sort that will provide input. The controller presents buttons and axes. Buttons are either pressed or not pressed. Axis provide analogue values.
    Author:
    Kevin Glass
    • Method Detail

      • getName

        String getName()
        Get the name assigned to this controller.
        Returns:
        The name assigned to this controller
      • getIndex

        int getIndex()
        Get the index of this controller in the collection
        Returns:
        The index of this controller in the collection
      • getButtonCount

        int getButtonCount()
        Retrieve the number of buttons available on this controller
        Returns:
        The number of butotns available on this controller
      • getButtonName

        String getButtonName​(int index)
        Get the name of the specified button. Be warned, often this is as exciting as "Button X"
        Parameters:
        index - The index of the button whose name should be retrieved
        Returns:
        The name of the button requested
      • isButtonPressed

        boolean isButtonPressed​(int index)
        Check if a button is currently pressed
        Parameters:
        index - The button to check
        Returns:
        True if the button is currently pressed
      • poll

        void poll()
        Poll the controller for new data. This will also update events
      • getPovX

        float getPovX()
        Get the X-Axis value of the POV on this controller
        Returns:
        The X-Axis value of the POV on this controller
      • getPovY

        float getPovY()
        Get the Y-Axis value of the POV on this controller
        Returns:
        The Y-Axis value of the POV on this controller
      • getDeadZone

        float getDeadZone​(int index)
        Get the dead zone for a specified axis
        Parameters:
        index - The index of the axis for which to retrieve the dead zone
        Returns:
        The dead zone for the specified axis
      • setDeadZone

        void setDeadZone​(int index,
                         float zone)
        Set the dead zone for the specified axis
        Parameters:
        index - The index of hte axis for which to set the dead zone
        zone - The dead zone to use for the specified axis
      • getAxisCount

        int getAxisCount()
        Retrieve the number of axes available on this controller.
        Returns:
        The number of axes available on this controller.
      • getAxisName

        String getAxisName​(int index)
        Get the name that's given to the specified axis
        Parameters:
        index - The index of the axis whose name should be retrieved
        Returns:
        The name of the specified axis.
      • getAxisValue

        float getAxisValue​(int index)
        Retrieve the value thats currently available on a specified axis. The value will always be between 1.0 and -1.0 and will calibrate as values are passed read. It may be useful to get the player to wiggle the joystick from side to side to get the calibration right.
        Parameters:
        index - The index of axis to be read
        Returns:
        The value from the specified axis.
      • getXAxisValue

        float getXAxisValue()
        Get the value from the X axis if there is one. If no X axis is defined a zero value will be returned.
        Returns:
        The value from the X axis
      • getXAxisDeadZone

        float getXAxisDeadZone()
        Get the dead zone for the X axis.
        Returns:
        The dead zone for the X axis
      • setXAxisDeadZone

        void setXAxisDeadZone​(float zone)
        Set the dead zone for the X axis
        Parameters:
        zone - The dead zone to use for the X axis
      • getYAxisValue

        float getYAxisValue()
        Get the value from the Y axis if there is one. If no Y axis is defined a zero value will be returned.
        Returns:
        The value from the Y axis
      • getYAxisDeadZone

        float getYAxisDeadZone()
        Get the dead zone for the Y axis.
        Returns:
        The dead zone for the Y axis
      • setYAxisDeadZone

        void setYAxisDeadZone​(float zone)
        Set the dead zone for the Y axis
        Parameters:
        zone - The dead zone to use for the Y axis
      • getZAxisValue

        float getZAxisValue()
        Get the value from the Z axis if there is one. If no Z axis is defined a zero value will be returned.
        Returns:
        The value from the Z axis
      • getZAxisDeadZone

        float getZAxisDeadZone()
        Get the dead zone for the Z axis.
        Returns:
        The dead zone for the Z axis
      • setZAxisDeadZone

        void setZAxisDeadZone​(float zone)
        Set the dead zone for the Z axis
        Parameters:
        zone - The dead zone to use for the Z axis
      • getRXAxisValue

        float getRXAxisValue()
        Get the value from the RX axis if there is one. If no RX axis is defined a zero value will be returned.
        Returns:
        The value from the RX axis
      • getRXAxisDeadZone

        float getRXAxisDeadZone()
        Get the dead zone for the RX axis.
        Returns:
        The dead zone for the RX axis
      • setRXAxisDeadZone

        void setRXAxisDeadZone​(float zone)
        Set the dead zone for the RX axis
        Parameters:
        zone - The dead zone to use for the RX axis
      • getRYAxisValue

        float getRYAxisValue()
        Get the value from the RY axis if there is one. If no RY axis is defined a zero value will be returned.
        Returns:
        The value from the RY axis
      • getRYAxisDeadZone

        float getRYAxisDeadZone()
        Get the dead zone for the RY axis.
        Returns:
        The dead zone for the RY axis
      • setRYAxisDeadZone

        void setRYAxisDeadZone​(float zone)
        Set the dead zone for the RY axis
        Parameters:
        zone - The dead zone to use for the RY axis
      • getRZAxisValue

        float getRZAxisValue()
        Get the value from the RZ axis if there is one. If no RZ axis is defined a zero value will be returned.
        Returns:
        The value from the RZ axis
      • getRZAxisDeadZone

        float getRZAxisDeadZone()
        Get the dead zone for the RZ axis.
        Returns:
        The dead zone for the RZ axis
      • setRZAxisDeadZone

        void setRZAxisDeadZone​(float zone)
        Set the dead zone for the RZ axis
        Parameters:
        zone - The dead zone to use for the RZ axis
      • getRumblerCount

        int getRumblerCount()
        Returns the number of rumblers this controller supports
      • getRumblerName

        String getRumblerName​(int index)
        Returns the name of the specified rumbler
        Parameters:
        index - The rumbler index
      • setRumblerStrength

        void setRumblerStrength​(int index,
                                float strength)
        Sets the vibration strength of the specified rumbler
        Parameters:
        index - The index of the rumbler
        strength - The strength to vibrate at