Removed some unneeded methods.
- Removed "isImplemented" field from GameMod as all of the base mods have been implemented. - Removed Utils.getBoundedValue() methods in preference for Utils.clamp(). Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -156,40 +156,6 @@ public class Utils {
|
||||
anim.draw(x - (anim.getWidth() / 2f), y - (anim.getHeight() / 2f));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a bounded value for a base value and displacement.
|
||||
* @param base the initial value
|
||||
* @param diff the value change
|
||||
* @param min the minimum value
|
||||
* @param max the maximum value
|
||||
* @return the bounded value
|
||||
*/
|
||||
public static int getBoundedValue(int base, int diff, int min, int max) {
|
||||
int val = base + diff;
|
||||
if (val < min)
|
||||
val = min;
|
||||
else if (val > max)
|
||||
val = max;
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a bounded value for a base value and displacement.
|
||||
* @param base the initial value
|
||||
* @param diff the value change
|
||||
* @param min the minimum value
|
||||
* @param max the maximum value
|
||||
* @return the bounded value
|
||||
*/
|
||||
public static float getBoundedValue(float base, float diff, float min, float max) {
|
||||
float val = base + diff;
|
||||
if (val < min)
|
||||
val = min;
|
||||
else if (val > max)
|
||||
val = max;
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps a value between a lower and upper bound.
|
||||
* @param val the value to clamp
|
||||
@@ -236,6 +202,13 @@ public class Utils {
|
||||
return (float) Math.sqrt((v1 * v1) + (v2 * v2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Linear interpolation of a and b at t.
|
||||
*/
|
||||
public static float lerp(float a, float b, float t) {
|
||||
return a * (1 - t) + b * t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a game input key is pressed (mouse/keyboard left/right).
|
||||
* @return true if pressed
|
||||
@@ -603,11 +576,4 @@ public class Utils {
|
||||
public static boolean parseBoolean(String s) {
|
||||
return (Integer.parseInt(s) == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Linear interpolation of a and b at t.
|
||||
*/
|
||||
public static float lerp(float a, float b, float t) {
|
||||
return a * (1 - t) + b * t;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user