wiiremotej
Class WiiRemoteAccelerometerMouse

java.lang.Object
  extended by wiiremotej.WiiRemoteMouse
      extended by wiiremotej.WiiRemoteAccelerometerMouse
Direct Known Subclasses:
MotionAccelerometerMouse, TiltAccelerometerMouse

public abstract class WiiRemoteAccelerometerMouse
extends WiiRemoteMouse

An interface for implementing mouse functionality using the Wii Remote through the accelerometer.


Field Summary
protected  int xSensitivity
          The sensitivity of the X-axis (pixels per unit).
protected  int ySensitivity
          The sensitivity of the Y-axis (pixels per unit).
 
Fields inherited from class wiiremotej.WiiRemoteMouse
robot
 
Constructor Summary
WiiRemoteAccelerometerMouse(int xSensitivity, int ySensitivity, int mouseButton1, int mouseButton2, int mouseButton3)
          Constructs a new WiiRemoteAccelerometerMouse.
 
Method Summary
 int getXSensitivity()
          Returns the X sensitivity of this "mouse" in pixels per unit.
 int getYSensitivity()
          Returns the Y sensitivity of this "mouse" in pixels per unit.
abstract  void processMotionEvent(WRAccelerationEvent evt)
          Processes the given WRAccelerationEvent and moves the mouse if necessary based on user settings and input.
 void processMotionEvent(WREvent[] evts)
          Processes the given event(s) and moves the mouse if necessary based on user settings and input.
 void setSensitivity(int ySensitivity)
          Sets the Y sensitivity of this "mouse" to the given value in pixels per unit.
 void setXSensitivity(int xSensitivity)
          Sets the X sensitivity of this "mouse" to the given value in pixels per unit.
 
Methods inherited from class wiiremotej.WiiRemoteMouse
getMouseButton1, getMouseButton2, getMouseButton3, processButtonEvent, setMouseButton1, setMouseButton2, setMouseButton3
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xSensitivity

protected int xSensitivity
The sensitivity of the X-axis (pixels per unit).


ySensitivity

protected int ySensitivity
The sensitivity of the Y-axis (pixels per unit).

Constructor Detail

WiiRemoteAccelerometerMouse

public WiiRemoteAccelerometerMouse(int xSensitivity,
                                   int ySensitivity,
                                   int mouseButton1,
                                   int mouseButton2,
                                   int mouseButton3)
                            throws java.awt.AWTException,
                                   java.lang.SecurityException
Constructs a new WiiRemoteAccelerometerMouse. For the mouse button values, see WRButtonEvent.

Parameters:
mouseButton1 - the key-press to map to mouse button 1. Use -1 if you don't want to map a key-press.
mouseButton2 - the key-press to map to mouse button 2. Use -1 if you don't want to map a key-press.
mouseButton3 - the key-press to map to mouse button 3. Use -1 if you don't want to map a key-press.
Throws:
java.awt.AWTException - if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
java.lang.SecurityException - if createRobot permission is not granted.
Method Detail

processMotionEvent

public abstract void processMotionEvent(WRAccelerationEvent evt)
Processes the given WRAccelerationEvent and moves the mouse if necessary based on user settings and input.

Parameters:
evt - the event to use when calculating mouse movement.

processMotionEvent

public void processMotionEvent(WREvent[] evts)
                        throws java.lang.IllegalArgumentException
Processes the given event(s) and moves the mouse if necessary based on user settings and input. This should NOT be called. If it is, index 0 of the array must contain a WRAccelerationEvent.

Specified by:
processMotionEvent in class WiiRemoteMouse
Parameters:
evts - the events to use when calculating mouse movement.
Throws:
java.lang.IllegalArgumentException - if index 0 of evts does not contain a WRAccelerationEvent.

getXSensitivity

public int getXSensitivity()
Returns the X sensitivity of this "mouse" in pixels per unit.

Returns:
the X sensitivity of this "mouse."

getYSensitivity

public int getYSensitivity()
Returns the Y sensitivity of this "mouse" in pixels per unit.

Returns:
the Y sensitivity of this "mouse."

setXSensitivity

public void setXSensitivity(int xSensitivity)
Sets the X sensitivity of this "mouse" to the given value in pixels per unit.

Parameters:
xSensitivity - the new X sensitivity value.

setSensitivity

public void setSensitivity(int ySensitivity)
Sets the Y sensitivity of this "mouse" to the given value in pixels per unit.

Parameters:
ySensitivity - the new Y sensitivity value.