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 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 booleanleftStickDown()protected abstract booleanleftStickLeft()protected abstract booleanleftStickRight()protected abstract booleanleftStickUp()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, wait
-
Methods inherited from interface be.yildizgames.module.controller.Controller
getModel, isConnected
-
-
-
-
Method Detail
-
getState
public final ControllerCurrentState 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
public final void addListener(ControllerListener l)
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
public final void use(ThreadRunner runner)
- Specified by:
usein interfaceController
-
map
public final void map(ControllerMapper mapper)
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.
-
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.
-
-