java.lang.Object Direction
public class Direction
An immutable class that describes a returned axis direction from the joypad. This includes the direction and it's strength.
The user should never need to create these themselves, instead they will be created and returned for you by the GamePad class.
Constructor Summary | |
---|---|
Direction(int angle,
float strength)
Creates a new direction. |
Method Summary | |
---|---|
int |
getAngle()
Angles are in degrees from 0 to 359, with 0 pointing to the east. |
double |
getAngleRadians()
Returns the same value as the getAngle method, however this is in radians instead of degrees. |
float |
getStrength()
Strength represents how far the axis is pushed in the given direction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Direction(int angle, float strength)
Creates a new direction. These are typically created for you by the GamePad class.
The
- angle for this direction in degrees.How
- strong the direction is moving in the given angle.Method Detail |
---|
public int getAngle()
Angles are in degrees from 0 to 359, with 0 pointing to the east.
public double getAngleRadians()
Returns the same value as the getAngle method, however this is in radians instead of degrees.
This is useful for when you are using the static trigonomic methods in the Math class, like Math.cos() and Math.sin().
public float getStrength()
Strength represents how far the axis is pushed in the given direction. 0 is that it is not being pushed at all, and 1 is that it is fully exerted as far as it can move. 0.5 would be moving the axis half way of the given direction.