org.jagatoo.input.listeners
Class InputAdapter

java.lang.Object
  extended by org.jagatoo.input.listeners.InputAdapter
All Implemented Interfaces:
ControllerListener, InputListener, KeyboardListener, MouseListener, MouseStopListener

public abstract class InputAdapter
extends java.lang.Object
implements InputListener

Simple adapter class that implements KeyboardListener, MouseListener and ControllerListener.


Constructor Summary
InputAdapter()
           
 
Method Summary
 long getMouseStopDelay()
          
 void onControllerAxisChanged(ControllerAxisChangedEvent e, ControllerAxis axis, float axisDelta)
          
 void onControllerButtonPressed(ControllerButtonPressedEvent e, ControllerButton button)
          
 void onControllerButtonReleased(ControllerButtonReleasedEvent e, ControllerButton button)
          
 void onControllerButtonStateChanged(ControllerButtonEvent e, ControllerButton button, boolean state)
          
 void onKeyPressed(KeyPressedEvent e, Key key)
          Used by implementing input classes to process a key pressed event.
 void onKeyReleased(KeyReleasedEvent e, Key key)
          Used by implementing input classes to process a key released event.
 void onKeyStateChanged(KeyStateEvent e, Key key, boolean state)
          Used by implementing input classes to process a key state changed event.
 void onKeyTyped(KeyTypedEvent e, char keyChar)
          Used by implementing input classes to process a key typed event.
 void onMouseButtonClicked(MouseButtonClickedEvent e, MouseButton button, int clickCount)
          Invoked when a button click was registered by the mouse device.
 void onMouseButtonPressed(MouseButtonPressedEvent e, MouseButton button)
          Invoked when a button press was registered by the mouse device.
 void onMouseButtonReleased(MouseButtonReleasedEvent e, MouseButton button)
          Invoked when a button release was registered by the mouse device.
 void onMouseButtonStateChanged(MouseButtonEvent e, MouseButton button, boolean state)
          Invoked when a button state-change was registered by the mouse device.
 void onMouseMoved(MouseMovedEvent e, int x, int y, int dx, int dy)
          Invoked when a change of the mouse's position was registered by the mouse device while in non-exclusive mode.
 void onMouseStopped(MouseStoppedEvent e, int x, int y)
          Invoked when a change of the mouse's position has not been registered for a certain amount of time.
 void onMouseWheelMoved(MouseWheelEvent e, int wheelDelta)
          Invoked when the mouse wheel has been moved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputAdapter

public InputAdapter()
Method Detail

onKeyPressed

public void onKeyPressed(KeyPressedEvent e,
                         Key key)
Used by implementing input classes to process a key pressed event. This method is generally invoked by Keyboard.

Specified by:
onKeyPressed in interface KeyboardListener
Parameters:
e - the KeyboardEvent, with all assotiated information

onKeyReleased

public void onKeyReleased(KeyReleasedEvent e,
                          Key key)
Used by implementing input classes to process a key released event. This method is generally invoked by Keyboard.

Specified by:
onKeyReleased in interface KeyboardListener
Parameters:
e - the KeyboardEvent, with all assotiated information

onKeyStateChanged

public void onKeyStateChanged(KeyStateEvent e,
                              Key key,
                              boolean state)
Used by implementing input classes to process a key state changed event. This method is generally invoked by Keyboard.

Specified by:
onKeyStateChanged in interface KeyboardListener
Parameters:
e - the KeyboardEvent, with all assotiated information

onKeyTyped

public void onKeyTyped(KeyTypedEvent e,
                       char keyChar)
Used by implementing input classes to process a key typed event. It is not the same as onKeyPressed or onKeyReleased since this even returns a char. It should be used e.g. for widgets which need a text input.

Specified by:
onKeyTyped in interface KeyboardListener
Parameters:
e - the KeyboardEvent, with all assotiated information

onMouseButtonPressed

public void onMouseButtonPressed(MouseButtonPressedEvent e,
                                 MouseButton button)
Invoked when a button press was registered by the mouse device.

Specified by:
onMouseButtonPressed in interface MouseListener
Parameters:
e - the MouseEvent with all assotiated data

onMouseButtonReleased

public void onMouseButtonReleased(MouseButtonReleasedEvent e,
                                  MouseButton button)
Invoked when a button release was registered by the mouse device.

Specified by:
onMouseButtonReleased in interface MouseListener
Parameters:
e - the MouseEvent with all assotiated data

onMouseButtonClicked

public void onMouseButtonClicked(MouseButtonClickedEvent e,
                                 MouseButton button,
                                 int clickCount)
Invoked when a button click was registered by the mouse device.

Specified by:
onMouseButtonClicked in interface MouseListener
Parameters:
e - the MouseEvent with all assotiated data

onMouseButtonStateChanged

public void onMouseButtonStateChanged(MouseButtonEvent e,
                                      MouseButton button,
                                      boolean state)
Invoked when a button state-change was registered by the mouse device.

Specified by:
onMouseButtonStateChanged in interface MouseListener
Parameters:
e - the MouseEvent with all assotiated data

onMouseMoved

public void onMouseMoved(MouseMovedEvent e,
                         int x,
                         int y,
                         int dx,
                         int dy)
Invoked when a change of the mouse's position was registered by the mouse device while in non-exclusive mode.

Specified by:
onMouseMoved in interface MouseListener
Parameters:
e - the MouseEvent with all assotiated data

onMouseWheelMoved

public void onMouseWheelMoved(MouseWheelEvent e,
                              int wheelDelta)
Invoked when the mouse wheel has been moved

Specified by:
onMouseWheelMoved in interface MouseListener
Parameters:
e - the MouseEvent with all assotiated data

getMouseStopDelay

public long getMouseStopDelay()

Specified by:
getMouseStopDelay in interface MouseStopListener
Returns:
the number of nano-seconds, the mouse needs to have stopped to fire this MouseStopListener.

onMouseStopped

public void onMouseStopped(MouseStoppedEvent e,
                           int x,
                           int y)
Invoked when a change of the mouse's position has not been registered for a certain amount of time.

Specified by:
onMouseStopped in interface MouseStopListener
Parameters:
e - the MouseStoppedEvent

onControllerAxisChanged

public void onControllerAxisChanged(ControllerAxisChangedEvent e,
                                    ControllerAxis axis,
                                    float axisDelta)

Specified by:
onControllerAxisChanged in interface ControllerListener

onControllerButtonPressed

public void onControllerButtonPressed(ControllerButtonPressedEvent e,
                                      ControllerButton button)

Specified by:
onControllerButtonPressed in interface ControllerListener

onControllerButtonReleased

public void onControllerButtonReleased(ControllerButtonReleasedEvent e,
                                       ControllerButton button)

Specified by:
onControllerButtonReleased in interface ControllerListener

onControllerButtonStateChanged

public void onControllerButtonStateChanged(ControllerButtonEvent e,
                                           ControllerButton button,
                                           boolean state)

Specified by:
onControllerButtonStateChanged in interface ControllerListener