Class ControllerRunner

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ControllerRunner()  
    • Method Summary

      Modifier and Type Method Description
      void addListener​(ControllerListener l)
      register a listener to receive event from the controller.
      protected abstract boolean button1()
      Get the status of the button 1.
      protected abstract boolean button2()
      Get the status of the button 2.
      protected abstract boolean button3()
      Get the status of the button 3.
      protected abstract boolean button4()
      Get the status of the button 4.
      protected abstract boolean buttonSelect()
      Get the status of the button select.
      protected abstract boolean buttonStart()
      Get the status of the button start.
      protected abstract boolean down()
      Get the status of the dpad down button.
      ControllerCurrentState getState()
      Provide the controller current state.
      boolean isUsed()
      Check if the controller is in use.
      protected abstract boolean left()
      Get the status of the dpad left button.
      protected abstract boolean leftStickDown()  
      protected abstract boolean leftStickLeft()  
      protected abstract boolean leftStickRight()  
      protected abstract boolean leftStickUp()  
      void map​(ControllerMapper mapper)
      Map the buttons if a change is required.
      protected abstract boolean right()
      Get the status of the dpad right button.
      void run()  
      protected abstract boolean up()
      Get the status of the dpad up button.
      void use()
      Use this controller.
      void use​(ThreadRunner runner)  
    • Constructor Detail

      • ControllerRunner

        protected ControllerRunner()
    • Method Detail

      • getState

        public final ControllerCurrentState getState()
        Description copied from interface: Controller
        Provide the controller current state. The state can be kept once retrieved, it will always be up to date.
        Specified by:
        getState in interface Controller
        Returns:
        The state.
      • addListener

        public final void addListener​(ControllerListener l)
        Description copied from interface: Controller
        register a listener to receive event from the controller.
        Specified by:
        addListener in interface Controller
        Parameters:
        l - Controller listener.
      • use

        public final void use()
        Description copied from interface: Controller
        Use this controller.
        Specified by:
        use in interface Controller
      • map

        public final void map​(ControllerMapper mapper)
        Description copied from interface: Controller
        Map the buttons if a change is required.
        Specified by:
        map in interface Controller
        Parameters:
        mapper - Button mapper.
      • isUsed

        public boolean isUsed()
        Description copied from interface: Controller
        Check if the controller is in use.
        Specified by:
        isUsed in interface Controller
        Returns:
        True if the controller is used, false otherwise.
      • run

        public final void run()
        Specified by:
        run in interface Runnable
      • down

        protected abstract boolean down()
        Get the status of the dpad down button.
        Returns:
        true if the dpad down is pressed, false otherwise.
      • up

        protected abstract boolean up()
        Get the status of the dpad up button.
        Returns:
        true if the dpad up is pressed, false otherwise.
      • right

        protected abstract boolean right()
        Get the status of the dpad right button.
        Returns:
        true if the dpad right is pressed, false otherwise.
      • left

        protected abstract boolean left()
        Get the status of the dpad left button.
        Returns:
        true if the dpad left is pressed, false otherwise.
      • leftStickLeft

        protected abstract boolean leftStickLeft()
      • leftStickRight

        protected abstract boolean leftStickRight()
      • leftStickUp

        protected abstract boolean leftStickUp()
      • leftStickDown

        protected abstract boolean leftStickDown()
      • button1

        protected abstract boolean button1()
        Get the status of the button 1.
        Returns:
        true if the button 1 is pressed, false otherwise.
      • button2

        protected abstract boolean button2()
        Get the status of the button 2.
        Returns:
        true if the button 2 is pressed, false otherwise.
      • button3

        protected abstract boolean button3()
        Get the status of the button 3.
        Returns:
        true if the button 3 is pressed, false otherwise.
      • button4

        protected abstract boolean button4()
        Get the status of the button 4.
        Returns:
        true if the button 4 is pressed, false otherwise.
      • buttonStart

        protected abstract boolean buttonStart()
        Get the status of the button start.
        Returns:
        true if the button start is pressed, false otherwise.
      • buttonSelect

        protected abstract boolean buttonSelect()
        Get the status of the button select.
        Returns:
        true if the button select is pressed, false otherwise.