draw sliders on correct times
This commit is contained in:
parent
022035dce5
commit
580f11a3d3
|
@ -122,6 +122,8 @@ public class Slider extends GameObject {
|
||||||
private int tickExpand = 0;
|
private int tickExpand = 0;
|
||||||
private final int TICKEXPAND = 200;
|
private final int TICKEXPAND = 200;
|
||||||
|
|
||||||
|
public int baseSliderFrom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Slider data type with images and dimensions.
|
* Initializes the Slider data type with images and dimensions.
|
||||||
* @param container the game container
|
* @param container the game container
|
||||||
|
@ -221,6 +223,11 @@ public class Slider extends GameObject {
|
||||||
|
|
||||||
float curveInterval = Options.isSliderSnaking() ? alpha : 1f;
|
float curveInterval = Options.isSliderSnaking() ? alpha : 1f;
|
||||||
//curve.draw(curveColor, curveInterval);
|
//curve.draw(curveColor, curveInterval);
|
||||||
|
float sliderprogress = (float) (trackPosition - getTime()) / sliderTimeTotal;
|
||||||
|
if (sliderprogress > 0) {
|
||||||
|
game.setSlidercurveFrom(baseSliderFrom + (int) (sliderprogress * curve.getCurvePoints().length));
|
||||||
|
}
|
||||||
|
game.setSlidercurveTo(baseSliderFrom + (int) (curveInterval * curve.getCurvePoints().length));
|
||||||
color.a = alpha;
|
color.a = alpha;
|
||||||
|
|
||||||
g.pushTransform();
|
g.pushTransform();
|
||||||
|
|
|
@ -44,9 +44,7 @@ import itdelatrisu.opsu.objects.Slider;
|
||||||
import itdelatrisu.opsu.objects.Spinner;
|
import itdelatrisu.opsu.objects.Spinner;
|
||||||
import itdelatrisu.opsu.objects.curves.Curve;
|
import itdelatrisu.opsu.objects.curves.Curve;
|
||||||
import itdelatrisu.opsu.objects.curves.Vec2f;
|
import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||||
import itdelatrisu.opsu.render.CurveRenderState;
|
|
||||||
import itdelatrisu.opsu.render.FrameBufferCache;
|
import itdelatrisu.opsu.render.FrameBufferCache;
|
||||||
import itdelatrisu.opsu.render.KnorkeCurveRenderStuff;
|
|
||||||
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
||||||
import itdelatrisu.opsu.replay.Replay;
|
import itdelatrisu.opsu.replay.Replay;
|
||||||
import itdelatrisu.opsu.replay.ReplayFrame;
|
import itdelatrisu.opsu.replay.ReplayFrame;
|
||||||
|
@ -1461,12 +1459,15 @@ public class Game extends BasicGameState {
|
||||||
List<Vec2f> curvepoints = new ArrayList<>();
|
List<Vec2f> curvepoints = new ArrayList<>();
|
||||||
for (GameObject gameObject : gameObjects) {
|
for (GameObject gameObject : gameObjects) {
|
||||||
if (gameObject.isSlider()) {
|
if (gameObject.isSlider()) {
|
||||||
|
((Slider) gameObject).baseSliderFrom = curvepoints.size();
|
||||||
curvepoints.addAll(Arrays.asList(((Slider) gameObject).getCurve().getCurvePoints()));
|
curvepoints.addAll(Arrays.asList(((Slider) gameObject).getCurve().getCurvePoints()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
knorkesliders = new FakeCombinedCurve(curvepoints.toArray(new Vec2f[curvepoints.size()]));
|
knorkesliders = new FakeCombinedCurve(curvepoints.toArray(new Vec2f[curvepoints.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slidercurveFrom = 0;
|
||||||
|
slidercurveTo = 0;
|
||||||
|
|
||||||
Dancer.instance.setGameObjects(gameObjects);
|
Dancer.instance.setGameObjects(gameObjects);
|
||||||
sbOverlay.setGameObjects(gameObjects);
|
sbOverlay.setGameObjects(gameObjects);
|
||||||
|
@ -1511,12 +1512,12 @@ public class Game extends BasicGameState {
|
||||||
private float slidercurveTo;
|
private float slidercurveTo;
|
||||||
|
|
||||||
public void setSlidercurveFrom(int slidercurveFrom) {
|
public void setSlidercurveFrom(int slidercurveFrom) {
|
||||||
float pos = slidercurveFrom / knorkesliders.getCurvePoints().length;
|
float pos = (float) slidercurveFrom / knorkesliders.getCurvePoints().length;
|
||||||
this.slidercurveFrom = Math.min(pos, this.slidercurveFrom);
|
this.slidercurveFrom = Math.max(pos, this.slidercurveFrom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSlidercurveTo(int slidercurveTo) {
|
public void setSlidercurveTo(int slidercurveTo) {
|
||||||
float pos = slidercurveTo / knorkesliders.getCurvePoints().length;
|
float pos = (float) slidercurveTo / knorkesliders.getCurvePoints().length;
|
||||||
this.slidercurveTo = Math.max(pos, this.slidercurveTo);
|
this.slidercurveTo = Math.max(pos, this.slidercurveTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user