Created CustomObjectRepository which can be serialized by Gson, storing all CustomImageObjects created
CustomObjectRepository is now being saved to and loaded from the ReplayFile The CustomObjectRenderer uses the GuiObjectManager's timeline cursor position as interpolation timestamp for the CustomImageObjects which are drawn if a GuiObjectManager is open (instant preview) KeyframeList's add() method now removes Keyframes with the same timestamp before adding the new Keyframe Transformations class now holds default values to prevent NullPointerExceptions in methods calling getTransformationForTimestamp() Added Javadoc to Transformation POJO Created NumberValueChangeListener which can be applied to GuiNumberInput objects Made step size customizable in GuiDraggingNumberInput Changing a ReplayImageAssets image now notifies the CustomImageObjects linked to that asset Modified RoundUtils to provide a round() method which uses the DecimalFormat class instead of Math.round which is unstable
This commit is contained in:
@@ -1,7 +1,23 @@
|
||||
package eu.crushedpixel.replaymod.utils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class RoundUtils {
|
||||
|
||||
public static double round2Decimals(double val) { return Math.round(val*100.0) / 100.0; }
|
||||
public static double round2Decimals(double val) {
|
||||
return round(val, 2);
|
||||
}
|
||||
|
||||
public static double round(double value, int places) {
|
||||
if (places < 0) throw new IllegalArgumentException();
|
||||
|
||||
StringBuilder format = new StringBuilder("#.");
|
||||
for(int i=0; i<places; i++) {
|
||||
format.append("#");
|
||||
}
|
||||
|
||||
DecimalFormat df = new DecimalFormat(format.toString());
|
||||
return Double.valueOf(df.format(value));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user