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 protectedControllerRunner() -
Method Summary
Modifier and Type Method Description voidaddListener(ControllerListener l)register a listener to receive event from the controller.protected abstract booleanbutton1()Get the status of the button 1.protected abstract booleanbutton2()Get the status of the button 2.protected abstract booleanbutton3()Get the status of the button 3.protected abstract booleanbutton4()Get the status of the button 4.protected abstract booleanbuttonL1()protected abstract booleanbuttonL2()protected abstract booleanbuttonR1()protected abstract booleanbuttonR2()protected abstract booleanbuttonSelect()Get the status of the button select.protected abstract booleanbuttonStart()Get the status of the button start.protected abstract booleandown()Get the status of the dpad down button.ControllerCurrentStategetState()Provide the controller current state.booleanisUsed()Check if the controller is in use.protected abstract booleanleft()Get the status of the dpad left button.protected abstract floatleftStickHorizontal()protected abstract floatleftStickVertical()voidmap(ControllerMapper mapper)Map the buttons if a change is required.protected abstract booleanright()Get the status of the dpad right button.voidrun()protected abstract booleanup()Get the status of the dpad up button.voiduse()Use this controller.voiduse(ThreadRunner runner)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface be.yildizgames.module.controller.Controller
getModel, isConnected
-
Constructor Details
-
ControllerRunner
protected ControllerRunner()
-
-
Method Details
-
getState
Description copied from interface:ControllerProvide the controller current state. The state can be kept once retrieved, it will always be up to date.- Specified by:
getStatein interfaceController- Returns:
- The state.
-
addListener
Description copied from interface:Controllerregister a listener to receive event from the controller.- Specified by:
addListenerin interfaceController- Parameters:
l- Controller listener.
-
use
public final void use()Description copied from interface:ControllerUse this controller.- Specified by:
usein interfaceController
-
use
- Specified by:
usein interfaceController
-
map
Description copied from interface:ControllerMap the buttons if a change is required.- Specified by:
mapin interfaceController- Parameters:
mapper- Button mapper.
-
isUsed
public boolean isUsed()Description copied from interface:ControllerCheck if the controller is in use.- Specified by:
isUsedin interfaceController- Returns:
- True if the controller is used, false otherwise.
-
run
public final void run() -
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.
-