wiiremotej
Class WiiRemoteMouse

java.lang.Object
  extended by wiiremotej.WiiRemoteMouse
Direct Known Subclasses:
AccelerometerMouse, AnalogStickMouse, IRAccelerometerMouse, IRMouse

public abstract class WiiRemoteMouse
extends java.lang.Object

An class for implementing mouse functionality using the Wii Remote. Note that the sensitivity value for the mouse is not related to the sensitivity for the devices it uses for input, i.e. increasing sensitivity on a IRMouse will not increase the sensitivity of the IR sensor in general. To invert the axes on any WiiRemoteMouse, simply supply negative values for sensitivity.


Field Summary
protected  double xSensitivity
          The sensitivity of the X-axis.
protected  double ySensitivity
          The sensitivity of the Y-axis.
 
Constructor Summary
protected WiiRemoteMouse(double xSensitivity, double ySensitivity)
          Constructs a new WiiRemoteMouse with the given sensitivity settings.
 
Method Summary
static WiiRemoteMouse getDefault()
          Returns a mouse with default settings.
 double getXSensitivity()
          Returns the X sensitivity of this "mouse."
 double getYSensitivity()
          Returns the Y sensitivity of this "mouse."
protected  void moveMouse(double x, double y, boolean needsConversion)
          Moves the mouse to the given coordinates.
 void setXSensitivity(double xSensitivity)
          Sets the X sensitivity of this "mouse" to the given value.
 void setYSensitivity(double ySensitivity)
          Sets the Y sensitivity of this "mouse" to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xSensitivity

protected double xSensitivity
The sensitivity of the X-axis. The meaning of this value differs for each kind of mouse, though in all cases, a negative value inverts the direction, and a value of 0 means no movement on the given axis.


ySensitivity

protected double ySensitivity
The sensitivity of the Y-axis. The meaning of this value differs for each kind of mouse, though in all cases, a negative value inverts the direction, and a value of 0 means no movement on the given axis.

Constructor Detail

WiiRemoteMouse

protected WiiRemoteMouse(double xSensitivity,
                         double ySensitivity)
                  throws java.awt.AWTException,
                         java.lang.SecurityException
Constructs a new WiiRemoteMouse with the given sensitivity settings.

Parameters:
xSensitivity - the sensitivity of the mouse on the X axis.
ySensitivity - the sensitivity of the mouse on the Y axis.
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

getXSensitivity

public double getXSensitivity()
Returns the X sensitivity of this "mouse."

Returns:
the X sensitivity of this "mouse."
See Also:
xSensitivity

getYSensitivity

public double getYSensitivity()
Returns the Y sensitivity of this "mouse."

Returns:
the Y sensitivity of this "mouse."
See Also:
ySensitivity

setXSensitivity

public void setXSensitivity(double xSensitivity)
Sets the X sensitivity of this "mouse" to the given value.

Parameters:
xSensitivity - the new X sensitivity value.
See Also:
xSensitivity

setYSensitivity

public void setYSensitivity(double ySensitivity)
Sets the Y sensitivity of this "mouse" to the given value.

Parameters:
ySensitivity - the new Y sensitivity value.
See Also:
xSensitivity

moveMouse

protected void moveMouse(double x,
                         double y,
                         boolean needsConversion)
Moves the mouse to the given coordinates. This method will also make sure that x and y are valid coordinates that fit within the bounds of the screen. If they are not, they will be changed to the nearest valid values. Handles multiple screens.

Parameters:
x - the X coordinate.
y - the Y coordinate.
needsConversion - if true, then the given coordinates are in percent-of-screen (0 to 1) and need to be converted to actual coordinates. Percent-of-screen coordinates may be less than 0 or greater than 1 (they will be reduced by this method), as long as they are meant to be interpreted on a 0 to 1 scale.

getDefault

public static WiiRemoteMouse getDefault()
                                 throws java.awt.AWTException,
                                        java.lang.SecurityException
Returns a mouse with default settings. A new mouse is created each time, and thus this method could throw an AWTException or a SecurityException. Note that this is just a placeholder method and will return null.

Returns:
a mouse with default settings.
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.