|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jagatoo.input.devices.InputDevice
org.jagatoo.input.devices.Controller
public abstract class Controller
This is the base-class for all Controller implementations.
Applications should always use instances as Controller, but never cast them to
the concrete implementation.
Instances can only be created/retrieved through an InputDeviceFactory.
| Constructor Summary | |
|---|---|
protected |
Controller(ControllerFactory sourceFactory,
InputSourceWindow sourceWindow,
EventQueue eventQueue,
java.lang.String name,
java.lang.Object implObj)
|
| Method Summary | |
|---|---|
void |
addControllerListener(ControllerListener l)
Adds a new ControllerListener to the list of notified instances. |
protected abstract ControllerAxis[] |
createAxesArray(java.lang.Object implObj)
|
protected abstract ControllerButton[] |
createButtonsArray(java.lang.Object implObj)
|
void |
destroy()
Destroys the InputDevice. |
protected abstract void |
destroyImpl()
Destroys the Controller. |
void |
fireControllerEvent(ControllerEvent e,
boolean consumeEvent)
This method just forwards to the concrete fire* methods. |
void |
fireOnControllerAxisChanged(ControllerAxisChangedEvent e,
boolean consumeEvent)
Fires a ControllerAxisChangedEvent and pushes it back to the pool,
if consumeEvent is true. |
void |
fireOnControllerButtonPressed(ControllerButtonPressedEvent e,
boolean consumeEvent)
Fires a ControllerButtonPressedEvent and pushes it back to the pool,
if consumeEvent is true. |
void |
fireOnControllerButtonReleased(ControllerButtonReleasedEvent e,
boolean consumeEvent)
Fires a ControllerButtonReleasedEvent and pushes it back to the pool,
if consumeEvent is true. |
int |
getAxesCount()
|
ControllerAxis |
getAxis(int index)
|
ControllerButton |
getButton(int index)
|
int |
getButtonsCount()
|
int |
getButtonState(ControllerButton button)
|
ControllerFactory |
getSourceFactory()
|
int |
getState(DeviceComponent component)
This method returns an abstract input-state for the given DeviceComponent. |
boolean |
hasControllerListener()
|
boolean |
hasListener()
|
boolean |
isButtonPressed(ControllerButton button)
|
ControllerAxisChangedEvent |
prepareControllerAxisChanged(ControllerAxis axis,
float delta,
long when)
Prepares a ControllerAxisChangedEvent for being fired. |
protected ControllerButtonPressedEvent |
prepareControllerButtonPressed(ControllerButton button,
long when)
Prepares a ControllerButtonPressedEvent for being fired. |
ControllerButtonReleasedEvent |
prepareControllerButtonReleased(ControllerButton button,
long when)
Prepares a ControllerButtonReleasedEvent for being fired. |
void |
removeControllerListener(ControllerListener l)
Removes a ControllerListener from the list of notified instances. |
java.lang.String |
toString()
|
| Methods inherited from class org.jagatoo.input.devices.InputDevice |
|---|
addInputStateListener, collectEvents, consumePendingEvents, equals, fireStateEventsAndDoActions, getEventQueue, getName, getSourceWindow, hasInputStateListener, isEnabled, onDeviceRegistered, onDeviceUnregistered, removeInputStateListener, setEnabled, update |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Controller(ControllerFactory sourceFactory,
InputSourceWindow sourceWindow,
EventQueue eventQueue,
java.lang.String name,
java.lang.Object implObj)
throws InputSystemException
InputSystemException| Method Detail |
|---|
public final ControllerFactory getSourceFactory()
ControllerFactory, that created this instance.public final int getAxesCount()
ControllerAxis mounted to this Controller.public final ControllerAxis getAxis(int index)
index -
public final int getButtonsCount()
ControllerButtons mounted to this Controller.public final ControllerButton getButton(int index)
index -
public int getState(DeviceComponent component)
throws InputSystemRuntimeException
getState in class InputDeviceInputSystemRuntimeExceptionpublic final boolean hasControllerListener()
ControllerListener is currently registered.public final boolean hasListener()
InputDevice.hasInputStateListener() or hasControllerListener() return true.public void addControllerListener(ControllerListener l)
ControllerListener to the list of notified instances.
l - public void removeControllerListener(ControllerListener l)
ControllerListener from the list of notified instances.
l - public final boolean isButtonPressed(ControllerButton button)
button -
ControllerButton is pressed on this Controller.public final int getButtonState(ControllerButton button)
button -
protected final ControllerButtonPressedEvent prepareControllerButtonPressed(ControllerButton button,
long when)
ControllerButtonPressedEvent for being fired.
button - when -
null, if no events are currently accepted.
public final void fireOnControllerButtonPressed(ControllerButtonPressedEvent e,
boolean consumeEvent)
ControllerButtonPressedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
public final ControllerButtonReleasedEvent prepareControllerButtonReleased(ControllerButton button,
long when)
ControllerButtonReleasedEvent for being fired.
button - when -
null, if no events are currently accepted.
public final void fireOnControllerButtonReleased(ControllerButtonReleasedEvent e,
boolean consumeEvent)
ControllerButtonReleasedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
public final ControllerAxisChangedEvent prepareControllerAxisChanged(ControllerAxis axis,
float delta,
long when)
ControllerAxisChangedEvent for being fired.
button - when -
null, if no events are currently accepted.
public final void fireOnControllerAxisChanged(ControllerAxisChangedEvent e,
boolean consumeEvent)
ControllerAxisChangedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
public final void fireControllerEvent(ControllerEvent e,
boolean consumeEvent)
e - consumeEvent - public java.lang.String toString()
toString in class java.lang.Object
protected abstract void destroyImpl()
throws InputSystemException
InputSystemException
public final void destroy()
throws InputSystemException
destroy in class InputDeviceInputSystemExceptionprotected abstract ControllerAxis[] createAxesArray(java.lang.Object implObj)
protected abstract ControllerButton[] createButtonsArray(java.lang.Object implObj)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||