Specify whether Curve uses scaled or unscaled coordinates.

Unscaled coordinates will be used in a future commit (hopefully).

Added a normalize() method to Vec2f.

Throw RuntimeExceptions for any Curve initialization errors; the game would crash anyway, and this way the objects can be substituted for DummyObjects for a graceful failure.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-09-02 01:47:15 -05:00
parent 6c956e927f
commit d360b73bf5
7 changed files with 74 additions and 43 deletions

View File

@@ -64,13 +64,21 @@ public abstract class Curve {
/**
* Constructor.
* @param hitObject the associated HitObject
* @param scaled whether to use scaled coordinates
*/
protected Curve(HitObject hitObject) {
protected Curve(HitObject hitObject, boolean scaled) {
this.hitObject = hitObject;
this.x = hitObject.getScaledX();
this.y = hitObject.getScaledY();
this.sliderX = hitObject.getScaledSliderX();
this.sliderY = hitObject.getScaledSliderY();
if (scaled) {
this.x = hitObject.getScaledX();
this.y = hitObject.getScaledY();
this.sliderX = hitObject.getScaledSliderX();
this.sliderY = hitObject.getScaledSliderY();
} else {
this.x = hitObject.getX();
this.y = hitObject.getY();
this.sliderX = hitObject.getSliderX();
this.sliderY = hitObject.getSliderY();
}
this.renderState = null;
}