|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwiiremotej.AnalogStickData
public class AnalogStickData
Represents a simple XY analog stick. AnalogSticks are immutable. The value of the x and y positions should be between -1 and 1, with -1 being tilted all the way left (for the X direction) or down (for the Y direction), 1 being tilted all the way right (for the X direction) or up (for the Y direction), and with 0 being the center. Unfortunately, the calibration data in the various devices that use analog sticks is not perfect, so some variation does occur. If precise accuracy is important to your code, you may wish to calibrate manually (i.e. have the user push the stick all the way to the left, record this as the minimum X, have the user push the stick all the way to the right, record this as the maximum X, and finally have the user leave the stick in the center and record this as the center value. Then just parse the values returned from this event to get accurate values). The calibration values are pretty good, though, so for most applications this should not be an issue.
Constructor Summary | |
---|---|
AnalogStickData(double x,
double y)
Creates a new AnalogStickData with the given X and Y values. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object object)
Returns true if the given object is the same as this AnalogStick; otherwise false . |
double |
getAngle()
Returns the angle of the analog stick, measured in radians from the positive X-axis towards the positive Y-axis. |
double |
getX()
Returns the X position of the analog stick, should be between -1 and 1. |
double |
getY()
Returns the Y position of the analog stick, should be between -1 and 1. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnalogStickData(double x, double y)
x
- the X position of the analog stick. Should be between -1 and 1.y
- the Y position of the analog stick. Should be between -1 and 1.Method Detail |
---|
public double getX()
public double getY()
public double getAngle()
public boolean equals(java.lang.Object object)
true
if the given object is the same as this AnalogStick; otherwise false
. Both X and Y must match.
equals
in class java.lang.Object
object
- the object to compare to for equality.
true
if the given object is the same as this AnalogStick; otherwise false
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |