|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwiiremotej.WiiRemoteMouse
wiiremotej.AccelerometerMouse
wiiremotej.TiltAccelerometerMouse
public class TiltAccelerometerMouse
A class for implementing a mouse using the accelerometer. It is assumed that the WiiRemote is held still and then tilted left/right and front/back. Mouse motion is determined from the pitch and roll only. Moving the remote (i.e. left, right, front back, up, down, etc) will produce some very odd results.
Field Summary |
---|
Fields inherited from class wiiremotej.AccelerometerMouse |
---|
NUNCHUK_EXTENSION, WII_REMOTE |
Fields inherited from class wiiremotej.WiiRemoteMouse |
---|
xSensitivity, ySensitivity |
Constructor Summary | |
---|---|
TiltAccelerometerMouse(double xSensitivity,
double ySensitivity,
int device,
double rollThreshold,
double pitchThreshold)
Creates a new TiltAccelerometerMouse with the given settings. |
Method Summary | |
---|---|
static TiltAccelerometerMouse |
getDefault()
Returns a basic tilt mouse with the following settings. |
double |
getPitchThreshold()
Returns the pitch threshold of this "mouse" in radians. |
double |
getRollThreshold()
Returns the roll threshold of this "mouse" in radians. |
void |
processMouseEvent(WRAccelerationEvent evt)
Processes an acceleration event and moves the mouse if necessary, according to sensitivity and threshold values. |
void |
setPitchThreshold(double pitchThreshold)
Sets the pitch threshold of this "mouse" to the given value in radians. |
void |
setRollThreshold(double rollThreshold)
Sets the roll threshold of this "mouse" to the given value in radians. |
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 TiltAccelerometerMouse(double xSensitivity, double ySensitivity, int device, double rollThreshold, double pitchThreshold) throws java.awt.AWTException, java.lang.SecurityException
xSensitivity
- pixels to move on the X axis per radian of roll. A negative modifier will move the mouse the opposite way.ySensitivity
- pixels to move on the Y axis per radian of pitch. A negative modifier will move the mouse the opposite way.device
- the device to use for acceleration input. See constant fields for options.rollThreshold
- the magnitude of the amount of roll necessary for the mouse to be moved on the X axis. This is in radians.pitchThreshold
- the magnitude of the amount of pitch necessary for the mouse to be moved on the Y axis. This is in radians.
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 TiltAccelerometerMouse 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 getRollThreshold()
public double getPitchThreshold()
public void setRollThreshold(double rollThreshold)
rollThreshold
- the new roll threshold.public void setPitchThreshold(double pitchThreshold)
pitchThreshold
- the new pitch threshold.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |