Class ControllerRunner

java.lang.Object
be.yildizgames.module.controller.internal.ControllerRunner
All Implemented Interfaces:
Controller, Runnable

public abstract class ControllerRunner
extends Object
implements Runnable, Controller
Author:
Gregory Van den Borre
  • 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 buttonL1()  
    protected abstract boolean buttonL2()  
    protected abstract boolean buttonR1()  
    protected abstract boolean buttonR2()  
    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 float leftStickHorizontal()  
    protected abstract float leftStickVertical()  
    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)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface be.yildizgames.module.controller.Controller

    getModel, isConnected
  • Constructor Details

    • ControllerRunner

      protected ControllerRunner()
  • Method Details

    • 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
    • use

      public final void use​(ThreadRunner runner)
      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.
    • leftStickHorizontal

      protected abstract float leftStickHorizontal()
    • leftStickVertical

      protected abstract float leftStickVertical()
    • 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.
    • buttonL1

      protected abstract boolean buttonL1()
    • buttonL2

      protected abstract boolean buttonL2()
    • buttonR1

      protected abstract boolean buttonR1()
    • buttonR2

      protected abstract boolean buttonR2()
    • 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.