use renderutils

This commit is contained in:
yugecin 2016-12-25 14:19:08 +01:00
parent a392875940
commit c219f078fb
3 changed files with 14 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import itdelatrisu.opsu.objects.curves.Vec2f;
import itdelatrisu.opsu.ui.Fonts; import itdelatrisu.opsu.ui.Fonts;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics; import org.newdawn.slick.Graphics;
import yugecin.opsudance.render.RenderUtils;
import yugecin.opsudance.sbv2.movers.StoryboardMover; import yugecin.opsudance.sbv2.movers.StoryboardMover;
import java.util.ArrayList; import java.util.ArrayList;
@ -210,11 +211,11 @@ public class StoryboardMoveImpl implements StoryboardMove {
int dif = y; int dif = y;
y += Fonts.SMALL.getLineHeight() * 1.1f; y += Fonts.SMALL.getLineHeight() * 1.1f;
dif = y - dif; dif = y - dif;
g.fillRect(screenWidth - 20, y - dif / 2 - 5, 10, 10); RenderUtils.fillCenteredRect(g, screenWidth - 20, y - dif / 2, 5);
} }
g.setColor(Color.cyan); g.setColor(Color.cyan);
for (Vec2f point : midPoints) { for (Vec2f point : midPoints) {
g.fillRect(point.x - POINTSIZE, point.y - POINTSIZE, POINTSIZE * 2 + 1, POINTSIZE * 2 + 1); RenderUtils.fillCenteredRect(g, point.x, point.y, POINTSIZE);
} }
} }

View File

@ -21,6 +21,7 @@ import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.objects.curves.Vec2f; import itdelatrisu.opsu.objects.curves.Vec2f;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics; import org.newdawn.slick.Graphics;
import yugecin.opsudance.render.RenderUtils;
public abstract class StoryboardMover { public abstract class StoryboardMover {
@ -76,7 +77,7 @@ public abstract class StoryboardMover {
g.setColor(renderColor); g.setColor(renderColor);
for (float t = 0; t <= 1f; t += StoryboardMover.CALC_DRAW_INTERVAL) { for (float t = 0; t <= 1f; t += StoryboardMover.CALC_DRAW_INTERVAL) {
float[] p = getPointAt(t); float[] p = getPointAt(t);
g.fillRect(p[0] - 1, p[1] - 1, 3, 3); RenderUtils.fillCenteredRect(g, p[0], p[1], 1);
} }
} }

View File

@ -20,6 +20,7 @@ package yugecin.opsudance.sbv2.movers;
import itdelatrisu.opsu.objects.curves.Vec2f; import itdelatrisu.opsu.objects.curves.Vec2f;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics; import org.newdawn.slick.Graphics;
import yugecin.opsudance.render.RenderUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -77,9 +78,16 @@ public abstract class StoryboardMultipointMover extends StoryboardMover {
@Override @Override
public void render(Graphics g) { public void render(Graphics g) {
g.setColor(Color.gray);
Vec2f lastPoint = start;
for (Vec2f point : points) {
RenderUtils.drawDottedLine(g, lastPoint.x, lastPoint.y, point.x, point.y, 20, 0);
lastPoint = point;
}
RenderUtils.drawDottedLine(g, lastPoint.x, lastPoint.y, end.x, end.y, 20, 0);
g.setColor(pointColor); g.setColor(pointColor);
for (Vec2f point : points) { for (Vec2f point : points) {
g.fillRect(point.x - POINTSIZE, point.y - POINTSIZE, POINTSIZE * 2 + 1, POINTSIZE * 2 + 1); RenderUtils.fillCenteredRect(g, point.x, point.y, POINTSIZE);
} }
super.render(g); super.render(g);
} }