wiiremotej
Class IRMouse

java.lang.Object
  extended by wiiremotej.WiiRemoteMouse
      extended by wiiremotej.IRMouse

public class IRMouse
extends WiiRemoteMouse

An interface for implementing mouse functionality using the Wii Remote through the IR sensor. Maps the IR camera's 1024X768 resolution to the screen. The mouse takes the average of all of the light points it sees on the screen (1, 2, 3, or 4) and uses the center point. Note that because this mouse uses absolute positioning, if sensitivity is set to be less than 1, the mouse will not be able to cover the whole screen.


Field Summary
 
Fields inherited from class wiiremotej.WiiRemoteMouse
xSensitivity, ySensitivity
 
Constructor Summary
IRMouse(double xSensitivity, double ySensitivity, double xThreshold, double yThreshold)
          Constructs a new IRMouse.
 
Method Summary
static IRMouse getDefault()
          Returns a basic IR mouse with the following basic settings.
 void processMouseEvent(WRIREvent evt)
          Processes the given WRIREvent and moves the mouse if necessary based on user settings and input.
 
Methods inherited from class wiiremotej.WiiRemoteMouse
getXSensitivity, getYSensitivity, moveMouse, setXSensitivity, setYSensitivity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IRMouse

public IRMouse(double xSensitivity,
               double ySensitivity,
               double xThreshold,
               double yThreshold)
        throws java.awt.AWTException,
               java.lang.SecurityException
Constructs a new IRMouse.

Parameters:
xSensitivity - the modifier to multiply the X offset (from the center of the screen) by. A negative modifier will move the mouse the opposite way.
ySensitivity - the modifier to multiply the Y offset (from the center of the screen) by. A negative modifier will move the mouse the opposite way.
xThreshold - the percent (0 to 1 scale) different the X coordinate must be to be counted as a change (and thus trigger mouse movement).
yThreshold - the percent (0 to 1 scale) different the Y coordinate must be to be counted as a change (and thus trigger mouse movement).
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.
java.lang.IllegalArgumentException - if xThreshold or yThreshold is less than 0.
Method Detail

getDefault

public static IRMouse getDefault()
                          throws java.awt.AWTException,
                                 java.lang.SecurityException
Returns a basic IR mouse with the following basic settings. xSensitivity: 1.3. ySensitivity: 1.3. xThreshold: 0.015. yThreshold: 0.015.

Returns:
a basic IR mouse.
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.

processMouseEvent

public void processMouseEvent(WRIREvent evt)
Processes the given WRIREvent and moves the mouse if necessary based on user settings and input. Maps the IR camera's 1024X768 resolution to the screen.

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