com.jmex.editors.swing.controls
Class ControlFieldListener

java.lang.Object
  extended by com.jmex.editors.swing.controls.ControlFieldListener
All Implemented Interfaces:
JoystickInputListener, KeyInputListener, MouseInputListener

public class ControlFieldListener
extends java.lang.Object
implements JoystickInputListener, MouseInputListener, KeyInputListener

Author:
Matthew D. Hicks

Constructor Summary
ControlFieldListener(GameControlEditor editor)
           
 
Method Summary
 void onAxis(Joystick controller, int axis, float axisValue)
          Invoked when an axis has changed it's value.
 void onButton(int button, boolean pressed, int x, int y)
          Called in KeyInput.update() whenever a mouse button is pressed or released.
 void onButton(Joystick controller, int button, boolean pressed)
          Invoked when a button was pressed or released.
 void onKey(char character, int keyCode, boolean pressed)
          Called in KeyInput.update() whenever a key is pressed or released.
 void onMove(int xDelta, int yDelta, int newX, int newY)
          Called in KeyInput.update() whenever the mouse is moved.
 void onWheel(int wheelDelta, int x, int y)
          Called in KeyInput.update() whenever the mouse wheel is rotated.
 void prompt(ControlField field)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControlFieldListener

public ControlFieldListener(GameControlEditor editor)
Method Detail

prompt

public void prompt(ControlField field)

onKey

public void onKey(char character,
                  int keyCode,
                  boolean pressed)
Description copied from interface: KeyInputListener
Called in KeyInput.update() whenever a key is pressed or released.

Specified by:
onKey in interface KeyInputListener
Parameters:
character - character associated with pressed key, 0 if not applicable (e.g. if key released)
keyCode - key code of the pressed/released key
pressed - true if key was pressed, false if released

onButton

public void onButton(int button,
                     boolean pressed,
                     int x,
                     int y)
Description copied from interface: MouseInputListener
Called in KeyInput.update() whenever a mouse button is pressed or released.

Specified by:
onButton in interface MouseInputListener
Parameters:
button - index of the mouse button that was pressed/released
pressed - true if button was pressed, false if released
x - x position of the mouse while button was pressed/released
y - y position of the mouse while button was pressed/released

onMove

public void onMove(int xDelta,
                   int yDelta,
                   int newX,
                   int newY)
Description copied from interface: MouseInputListener
Called in KeyInput.update() whenever the mouse is moved.

Specified by:
onMove in interface MouseInputListener
Parameters:
xDelta - delta of the x coordinate since the last mouse movement event
yDelta - delta of the y coordinate since the last mouse movement event
newX - x position of the mouse after the mouse was moved
newY - y position of the mouse after the mouse was moved

onWheel

public void onWheel(int wheelDelta,
                    int x,
                    int y)
Description copied from interface: MouseInputListener
Called in KeyInput.update() whenever the mouse wheel is rotated.

Specified by:
onWheel in interface MouseInputListener
Parameters:
wheelDelta - steps the wheel was rotated
x - x position of the mouse while wheel was rotated
y - y position of the mouse while wheel was rotated

onAxis

public void onAxis(Joystick controller,
                   int axis,
                   float axisValue)
Description copied from interface: JoystickInputListener
Invoked when an axis has changed it's value.

Specified by:
onAxis in interface JoystickInputListener
Parameters:
controller - joystick the axis belongs to
axis - index of the axis
axisValue - new value of the axis

onButton

public void onButton(Joystick controller,
                     int button,
                     boolean pressed)
Description copied from interface: JoystickInputListener
Invoked when a button was pressed or released.

Specified by:
onButton in interface JoystickInputListener
Parameters:
controller - joystick the button belongs to
button - index of the button
pressed - true if button was pressed, false if released