|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jagatoo.input.InputSystem
public class InputSystem
The InputSystem is the root starting point for all input related tasks.
You can use it as a singleton by using the getInstance() method to retrieve
an instance.
The InputSystem allows for registering InputDevices and
appropriate listeners/managers.
| Field Summary | |
|---|---|
static LogChannel |
LOG_CHANNEL
|
| Constructor Summary | |
|---|---|
InputSystem()
Creates a new InputSystem instance. |
|
| Method Summary | |
|---|---|
void |
addInputHandler(InputHandler<?> inputHandler)
Adds an InputHandler to be updated automatically. |
void |
addInputListener(InputListener l)
Adds an InputListener. |
void |
addInputStateListener(InputStateListener l)
Adds an InputStateListener. |
protected void |
collectControllerEvents(EventQueue eventQueue,
long nanoTime)
|
void |
collectEvents(long nanoTime)
Processes pending events from the system and places them into the EventQueue. |
protected void |
collectKeyboardEvents(long nanoTime)
|
protected void |
collectMouseEvents(long nanoTime)
|
void |
deregisterController(Controller controller)
Deregisters the given Controller from this InputSystem. |
void |
deregisterInputStatesManager(InputStatesManager mgr)
Deregisters an InputStatesManager. |
void |
deregisterKeyboard(Keyboard keyboard)
Deregisters the given Keyboard from this InputSystem and calls the destroy() method. |
void |
deregisterMouse(Mouse mouse)
Deregisters the given Mouse from this InputSystem. |
void |
destroy()
Destroys the InputSystem. |
void |
destroy(ControllerFactory deviceFactory)
Destroys all Controllers from the given factory. |
void |
destroy(InputDeviceFactory deviceFactory)
Destroys all InputDevices from the given factory. |
void |
destroy(InputSourceWindow sourceWindow)
Destroys all InputDevices from the InputDeviceFactory,
that is retrieved from the given InputSourceWindow. |
void |
destroy(KeyboardFactory deviceFactory)
Destroys all Keyboards from the given factory. |
void |
destroy(MouseFactory deviceFactory)
Destroys all Mouses from the given factory. |
Controller |
getController()
|
Controller |
getController(int index)
|
Controller[] |
getControllers()
|
int |
getControllersCount()
|
EventQueue |
getEventQueue()
|
static InputSystem |
getInstance()
|
Keyboard |
getKeyboard()
|
Keyboard |
getKeyboard(int index)
|
Keyboard[] |
getKeyboards()
|
int |
getKeyboardsCount()
|
Mouse |
getMouse()
|
Mouse |
getMouse(int index)
|
long |
getMouseButtonClickThreshold()
|
Mouse[] |
getMouses()
|
int |
getMousesCount()
|
boolean |
hasController()
|
static boolean |
hasInstance()
|
boolean |
hasKeyboard()
|
boolean |
hasMouse()
|
boolean |
isControllerRegistered(Controller controller)
Checks, wether the given Controller is already registered at this InputSystem. |
boolean |
isKeyboardRegistered(Keyboard keyboard)
Checks, wether the given Keyboard is already registered at this InputSystem. |
boolean |
isMouseRegistered(Mouse mouse)
Checks, wether the given Mouse is already registered at this InputSystem. |
void |
notifyInputStatesManagers(InputDevice device,
DeviceComponent comp,
int state,
int delta,
long nanoTime)
Notifies all registered InputStateManagers about a state-change. |
void |
registerController(Controller controller)
Registers the given Controller at this InputSystem. |
void |
registerInputStatesManager(InputStatesManager mgr)
Registers an InputStatesManager to be updated automatically. |
void |
registerKeyboard(Keyboard keyboard)
Registers the given Keyboard at this InputSystem. |
void |
registerMouse(Mouse mouse)
Registers the given Mouse at this InputSystem. |
Controller |
registerNewController(ControllerFactory factory)
Registers a new Controller. |
Controller |
registerNewController(InputSourceWindow sourceWindow)
Registers a new Controller. |
Keyboard |
registerNewKeyboard(InputSourceWindow sourceWindow)
Registers a new Keyboard. |
Keyboard |
registerNewKeyboard(KeyboardFactory factory)
Registers a new Keyboard. |
void |
registerNewKeyboardAndMouse(InputDeviceFactory factory)
Registers a new Keyboard and Mouse. |
void |
registerNewKeyboardAndMouse(InputSourceWindow sourceWindow)
Registers a new Keyboard and Mouse. |
Mouse |
registerNewMouse(InputSourceWindow sourceWindow)
Registers a new Mouse. |
Mouse |
registerNewMouse(MouseFactory factory)
Registers a new Mouse. |
void |
removeInputHandler(InputHandler<?> inputHandler)
Removes an InputHandler. |
void |
removeInputListener(InputListener l)
Removes an InputListener from this InputSystem and all
registered InputDevices. |
void |
removeInputStateListener(InputStateListener l)
Removes an InputStateListener from this InputSystem and all
registered InputDevices. |
static void |
setInstance(InputSystem inputSystem)
Sets the instance to be used as the singleton instance. |
void |
setMouseButtonClickThreshold(long threshold)
Sets the threshold delay for collecting mouse-clicked-events. |
void |
update(long nanoTime)
Processes pending events from the system and directly fires them (notifes the listeners). |
protected void |
updateControllers(EventQueue eventQueue,
long nanoTime)
|
protected void |
updateInputHandlers(long nanoTime)
|
protected void |
updateKeyboards(long nanoTime)
|
protected void |
updateMouses(long nanoTime)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final LogChannel LOG_CHANNEL
| Constructor Detail |
|---|
public InputSystem()
| Method Detail |
|---|
public static final void setInstance(InputSystem inputSystem)
inputSystem - public static final boolean hasInstance()
true, if there currently is a singleton-instance.public static final InputSystem getInstance()
public final EventQueue getEventQueue()
public void registerInputStatesManager(InputStatesManager mgr)
InputStatesManager to be updated automatically.
mgr - public void deregisterInputStatesManager(InputStatesManager mgr)
InputStatesManager.
mgr -
public final void notifyInputStatesManagers(InputDevice device,
DeviceComponent comp,
int state,
int delta,
long nanoTime)
device - comp - state - delta - nanoTime - public void addInputHandler(InputHandler<?> inputHandler)
InputHandler to be updated automatically.InputHandler.setInputSystem(InputSystem)
with this InputSystem as the parameter.
inputHandler - public void removeInputHandler(InputHandler<?> inputHandler)
InputHandler.InputHandler.setInputSystem(InputSystem)
with null as the parameter.
inputHandler - public void addInputListener(InputListener l)
InputListener.InputDevices
and also adds them to all devices, that are registered later.
l - public void removeInputListener(InputListener l)
InputListener from this InputSystem and all
registered InputDevices.
l - public void addInputStateListener(InputStateListener l)
InputStateListener.InputDevices
and also adds them to all devices, that are registered later.
l - public void removeInputStateListener(InputStateListener l)
InputStateListener from this InputSystem and all
registered InputDevices.
l -
public void registerKeyboard(Keyboard keyboard)
throws InputSystemException
keyboard -
InputSystemException
public final Keyboard registerNewKeyboard(KeyboardFactory factory)
throws InputSystemException
factory -
InputSystemException
public final Keyboard registerNewKeyboard(InputSourceWindow sourceWindow)
throws InputSystemException
sourceWindow -
InputSystemException
public void deregisterKeyboard(Keyboard keyboard)
throws InputSystemException
keyboard -
InputSystemExceptionpublic final boolean hasKeyboard()
true, if at least one Keyboard is currently registered.public final int getKeyboardsCount()
public final Keyboard getKeyboard()
public final Keyboard getKeyboard(int index)
index -
public final Keyboard[] getKeyboards()
public final boolean isKeyboardRegistered(Keyboard keyboard)
keyboard -
public void setMouseButtonClickThreshold(long threshold)
threshold - in nano-secondspublic final long getMouseButtonClickThreshold()
public void registerMouse(Mouse mouse)
throws InputSystemException
mouse -
InputSystemException
public final Mouse registerNewMouse(MouseFactory factory)
throws InputSystemException
factory -
InputSystemException
public final Mouse registerNewMouse(InputSourceWindow sourceWindow)
throws InputSystemException
sourceWindow -
InputSystemException
public void deregisterMouse(Mouse mouse)
throws InputSystemException
mouse -
InputSystemExceptionpublic final boolean hasMouse()
true, if at least one Mouse is currently registered at this InputSystem.public final int getMousesCount()
public final Mouse getMouse()
public final Mouse getMouse(int index)
index -
public final Mouse[] getMouses()
public final boolean isMouseRegistered(Mouse mouse)
mouse -
public final void registerNewKeyboardAndMouse(InputDeviceFactory factory)
throws InputSystemException
factory -
InputSystemException
public final void registerNewKeyboardAndMouse(InputSourceWindow sourceWindow)
throws InputSystemException
sourceWindow -
InputSystemException
public void registerController(Controller controller)
throws InputSystemException
controller -
InputSystemException
public final Controller registerNewController(ControllerFactory factory)
throws InputSystemException
factory -
InputSystemException
public final Controller registerNewController(InputSourceWindow sourceWindow)
throws InputSystemException
sourceWindow -
InputSystemException
public void deregisterController(Controller controller)
throws InputSystemException
controller -
InputSystemExceptionpublic final boolean hasController()
true, if at least one Controller is currently registered.public final int getControllersCount()
public final Controller getController()
public final Controller getController(int index)
index -
public final Controller[] getControllers()
public final boolean isControllerRegistered(Controller controller)
controller -
protected void collectKeyboardEvents(long nanoTime)
throws InputSystemException
InputSystemException
protected void collectMouseEvents(long nanoTime)
throws InputSystemException
InputSystemException
protected void collectControllerEvents(EventQueue eventQueue,
long nanoTime)
throws InputSystemException
InputSystemException
public void collectEvents(long nanoTime)
throws InputSystemException
#update(InputSystem, EventQueue, long)
method is invoked.
nanoTime -
InputSystemException
protected void updateKeyboards(long nanoTime)
throws InputSystemException
InputSystemException
protected void updateMouses(long nanoTime)
throws InputSystemException
InputSystemException
protected void updateControllers(EventQueue eventQueue,
long nanoTime)
throws InputSystemException
InputSystemException
protected void updateInputHandlers(long nanoTime)
throws InputSystemException
InputSystemException
public void update(long nanoTime)
throws InputSystemException
#collectEvents(InputSystem, EventQueue, long)
method placed events into it.
nanoTime -
InputSystemException
public void destroy()
throws InputSystemException
InputSystemException
public void destroy(KeyboardFactory deviceFactory)
throws InputSystemException
deviceFactory -
InputSystemException
public void destroy(MouseFactory deviceFactory)
throws InputSystemException
deviceFactory -
InputSystemException
public void destroy(ControllerFactory deviceFactory)
throws InputSystemException
deviceFactory -
InputSystemException
public void destroy(InputDeviceFactory deviceFactory)
throws InputSystemException
deviceFactory -
InputSystemException
public final void destroy(InputSourceWindow sourceWindow)
throws InputSystemException
InputDeviceFactory,
that is retrieved from the given InputSourceWindow.
sourceWindow -
InputSystemException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||