|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwiiremotej.WiiRemoteMouse
wiiremotej.AccelerometerMouse
wiiremotej.MotionAccelerometerMouse
public class MotionAccelerometerMouse
A class for implementing a mouse using the accelerometer. It is assumed that the WiiRemote is held flat and then moved left/right and up/down. Mouse motion is determined from the X and Z accelerations only. Turning the remote on its side will produce some very odd results. Note that the Z axis of the Wii Remote is used because the Y axis is into the computer, and that makes a lot less sense than moving the remote up and down.
Field Summary |
---|
Fields inherited from class wiiremotej.AccelerometerMouse |
---|
NUNCHUK_EXTENSION, WII_REMOTE |
Fields inherited from class wiiremotej.WiiRemoteMouse |
---|
xSensitivity, ySensitivity |
Constructor Summary | |
---|---|
MotionAccelerometerMouse(double xSensitivity,
double ySensitivity,
int device,
double xMotionThreshold,
double zMotionThreshold)
Creates a new MotionAccelerometerMouse with the given settings. |
Method Summary | |
---|---|
static MotionAccelerometerMouse |
getDefault()
Returns a basic motion mouse with the following settings. |
double |
getXMotionThreshold()
Returns the X motion threshold of this "mouse" in Gs. |
double |
getZMotionThreshold()
Returns the Z motion threshold of this "mouse" in Gs. |
void |
processMouseEvent(WRAccelerationEvent evt)
Processes an acceleration event and moves the mouse if necessary, according to sensitivity and motion threshold values. |
void |
setXMotionThreshold(double xMotionThreshold)
Sets the X motion threshold of this "mouse" to the given value in Gs. |
void |
setZMotionThreshold(double zMotionThreshold)
Sets the Z motion threshold of this "mouse" to the given value in Gs. |
Methods inherited from class wiiremotej.AccelerometerMouse |
---|
getDevice, setDevice |
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 |
---|
public MotionAccelerometerMouse(double xSensitivity, double ySensitivity, int device, double xMotionThreshold, double zMotionThreshold) throws java.awt.AWTException, java.lang.SecurityException
xSensitivity
- pixels to move on the X axis per G of X acceleration. A negative modifier will move the mouse the opposite way.ySensitivity
- pixels to move on the Y axis per G of Z acceleration. A negative modifier will move the mouse the opposite way.device
- the device to use for acceleration input. See constant fields for options.xMotionThreshold
- the magnitude of the amount of acceleration necessary on the X axis for the mouse to be moved on the X axis. This is in Gs.zMotionThreshold
- the magnitude of the amount of acceleration necessary on the Z axis for the mouse to be moved on the Y axis. This is in Gs.
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 |
---|
public void processMouseEvent(WRAccelerationEvent evt)
processMouseEvent
in class AccelerometerMouse
evt
- the acceleration event to process.public static MotionAccelerometerMouse getDefault() throws java.awt.AWTException, java.lang.SecurityException
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.public double getXMotionThreshold()
public double getZMotionThreshold()
public void setXMotionThreshold(double xMotionThreshold)
xMotionThreshold
- the new X motion threshold.public void setZMotionThreshold(double zMotionThreshold)
zMotionThreshold
- the new Z motion threshold.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |