public class Utils
extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static int |
argmax(double[] values) |
static Vector2d |
choice(java.util.ArrayList<Vector2d> elements,
java.util.Random rnd) |
static java.lang.Object |
choice(java.lang.Object[] elements,
java.util.Random rnd) |
static java.lang.String |
formatString(java.lang.String str) |
static double |
normalise(double a_value,
double a_min,
double a_max) |
static Vector2d |
processMovementActionKeys(boolean[] key_pressed) |
static boolean |
processUseKey(boolean[] key_pressed) |
static java.awt.Polygon |
roundedPoints(java.awt.Rectangle rect) |
static java.awt.Polygon |
triPoints(java.awt.Rectangle rect,
Vector2d orientation)
Returns the Polygon for a triangle in the middle of the provided
rect, pointing in the orientation
(given as angle from upwards, or orientation vector)
|
public static java.lang.Object choice(java.lang.Object[] elements, java.util.Random rnd)
public static java.lang.String formatString(java.lang.String str)
public static java.awt.Polygon triPoints(java.awt.Rectangle rect, Vector2d orientation)
rect
- rectangle with the locationorientation
- orientation of the sprite.public static java.awt.Polygon roundedPoints(java.awt.Rectangle rect)
public static Vector2d processMovementActionKeys(boolean[] key_pressed)
public static double normalise(double a_value, double a_min, double a_max)
public static boolean processUseKey(boolean[] key_pressed)
public static int argmax(double[] values)