render mirrored
This commit is contained in:
parent
72aa856818
commit
9a73ab23e9
|
@ -89,7 +89,7 @@ public class Circle extends GameObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g, int trackPosition) {
|
||||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||
int timeDiff = hitObject.getTime() - trackPosition;
|
||||
final int approachTime = game.getApproachTime();
|
||||
final int fadeInTime = game.getFadeInTime();
|
||||
|
@ -98,6 +98,11 @@ public class Circle extends GameObject {
|
|||
float fadeinScale = (timeDiff - approachTime + fadeInTime) / (float) fadeInTime;
|
||||
float alpha = Utils.clamp(1 - fadeinScale, 0, 1);
|
||||
|
||||
g.pushTransform();
|
||||
if (mirror) {
|
||||
g.rotate(x, y, -180f);
|
||||
}
|
||||
|
||||
if (GameMod.HIDDEN.isActive()) {
|
||||
final int hiddenDecayTime = game.getHiddenDecayTime();
|
||||
final int hiddenTimeDiff = game.getHiddenTimeDiff();
|
||||
|
@ -122,6 +127,8 @@ public class Circle extends GameObject {
|
|||
GameImage.HITCIRCLE_OVERLAY.getImage().drawCentered(x, y, Colors.WHITE_FADE);
|
||||
|
||||
Colors.WHITE_FADE.a = oldAlpha;
|
||||
|
||||
g.popTransform();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public class DummyObject extends GameObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g, int trackPosition) {}
|
||||
public void draw(Graphics g, int trackPosition, boolean mirror) {}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed, int trackPosition) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public abstract class GameObject {
|
|||
* @param g the graphics context
|
||||
* @param trackPosition the current track position
|
||||
*/
|
||||
public abstract void draw(Graphics g, int trackPosition);
|
||||
public abstract void draw(Graphics g, int trackPosition, boolean mirrored);
|
||||
|
||||
/**
|
||||
* Updates the hit object.
|
||||
|
|
|
@ -176,7 +176,7 @@ public class Slider extends GameObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g, int trackPosition) {
|
||||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||
int timeDiff = hitObject.getTime() - trackPosition;
|
||||
final int approachTime = game.getApproachTime();
|
||||
final int fadeInTime = game.getFadeInTime();
|
||||
|
@ -196,6 +196,11 @@ public class Slider extends GameObject {
|
|||
curve.draw(color,curveInterval);
|
||||
color.a = alpha;
|
||||
|
||||
g.pushTransform();
|
||||
if (mirror) {
|
||||
g.rotate(x, y, -180f);
|
||||
}
|
||||
|
||||
/*
|
||||
// end circle
|
||||
Vec2f endCircPos = curve.pointAt(curveInterval);
|
||||
|
@ -208,6 +213,8 @@ public class Slider extends GameObject {
|
|||
if (!overlayAboveNumber)
|
||||
hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE);
|
||||
|
||||
g.popTransform();
|
||||
|
||||
// ticks
|
||||
if (ticksT != null) {
|
||||
float tickScale = 0.5f + 0.5f * AnimationEquation.OUT_BACK.calc(decorationsAlpha);
|
||||
|
@ -215,10 +222,21 @@ public class Slider extends GameObject {
|
|||
for (int i = 0; i < ticksT.length; i++) {
|
||||
Vec2f c = curve.pointAt(ticksT[i]);
|
||||
Colors.WHITE_FADE.a = decorationsAlpha;
|
||||
g.pushTransform();
|
||||
if (mirror) {
|
||||
g.rotate(c.x, c.y, -180f);
|
||||
}
|
||||
tick.drawCentered(c.x, c.y, Colors.WHITE_FADE);
|
||||
g.popTransform();
|
||||
Colors.WHITE_FADE.a = alpha;
|
||||
}
|
||||
}
|
||||
|
||||
g.pushTransform();
|
||||
if (mirror) {
|
||||
g.rotate(x, y, -180f);
|
||||
}
|
||||
|
||||
if (GameMod.HIDDEN.isActive()) {
|
||||
final int hiddenDecayTime = game.getHiddenDecayTime();
|
||||
final int hiddenTimeDiff = game.getHiddenTimeDiff();
|
||||
|
@ -235,6 +253,8 @@ public class Slider extends GameObject {
|
|||
if (overlayAboveNumber)
|
||||
hitCircleOverlay.drawCentered(x, y, Colors.WHITE_FADE);
|
||||
|
||||
g.popTransform();
|
||||
|
||||
// repeats
|
||||
if (curveInterval == 1.0f) {
|
||||
for (int tcurRepeat = currentRepeats; tcurRepeat <= currentRepeats + 1; tcurRepeat++) {
|
||||
|
@ -264,8 +284,14 @@ public class Slider extends GameObject {
|
|||
|
||||
if (timeDiff >= 0) {
|
||||
// approach circle
|
||||
if (!GameMod.HIDDEN.isActive())
|
||||
g.pushTransform();
|
||||
if (mirror) {
|
||||
g.rotate(x, y, -180f);
|
||||
}
|
||||
if (!GameMod.HIDDEN.isActive()) {
|
||||
GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color);
|
||||
}
|
||||
g.popTransform();
|
||||
} else {
|
||||
// Since update() might not have run before drawing during a replay, the
|
||||
// slider time may not have been calculated, which causes NAN numbers and flicker.
|
||||
|
|
|
@ -175,7 +175,10 @@ public class Spinner extends GameObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g, int trackPosition) {
|
||||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||
if (mirror) {
|
||||
return;
|
||||
}
|
||||
// only draw spinners shortly before start time
|
||||
int timeDiff = hitObject.getTime() - trackPosition;
|
||||
final int fadeInTime = game.getFadeInTime();
|
||||
|
|
|
@ -47,10 +47,7 @@ import itdelatrisu.opsu.render.FrameBufferCache;
|
|||
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
||||
import itdelatrisu.opsu.replay.Replay;
|
||||
import itdelatrisu.opsu.replay.ReplayFrame;
|
||||
import itdelatrisu.opsu.ui.Colors;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import itdelatrisu.opsu.ui.MenuButton;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
import itdelatrisu.opsu.ui.*;
|
||||
import itdelatrisu.opsu.ui.animations.AnimationEquation;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -269,8 +266,11 @@ public class Game extends BasicGameState {
|
|||
private Input input;
|
||||
private final int state;
|
||||
|
||||
private final Cursor mirrorCursor;
|
||||
|
||||
public Game(int state) {
|
||||
this.state = state;
|
||||
mirrorCursor = new Cursor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -599,8 +599,14 @@ public class Game extends BasicGameState {
|
|||
|
||||
if (isReplay)
|
||||
UI.draw(g, replayX, replayY, replayKeyPressed);
|
||||
else if (GameMod.AUTO.isActive())
|
||||
else if (GameMod.AUTO.isActive()) {
|
||||
UI.draw(g, (int) autoMousePosition.x, (int) autoMousePosition.y, autoMousePressed);
|
||||
double dx = autoMousePosition.x - Options.width / 2d;
|
||||
double dy = autoMousePosition.y - Options.height / 2d;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
double a = Math.atan2(dy, dx) + Math.PI;
|
||||
mirrorCursor.draw((int) (Math.cos(a) * d + Options.width / 2), (int) (Math.sin(a) * d + Options.height / 2), autoMousePressed);
|
||||
}
|
||||
else if (GameMod.AUTOPILOT.isActive())
|
||||
UI.draw(g, (int) autoMousePosition.x, (int) autoMousePosition.y, Utils.isGameKeyPressed());
|
||||
else
|
||||
|
@ -1389,9 +1395,13 @@ public class Game extends BasicGameState {
|
|||
GameObject gameObj = gameObjects[idx];
|
||||
|
||||
// normal case
|
||||
if (!loseState)
|
||||
gameObj.draw(g, trackPosition);
|
||||
|
||||
if (!loseState) {
|
||||
gameObj.draw(g, trackPosition, false);
|
||||
g.pushTransform();
|
||||
g.rotate(Options.width / 2f, Options.height / 2f, 180f);
|
||||
gameObj.draw(g, trackPosition, true);
|
||||
g.popTransform();
|
||||
}
|
||||
// death: make objects "fall" off the screen
|
||||
else {
|
||||
// time the object began falling
|
||||
|
@ -1417,7 +1427,7 @@ public class Game extends BasicGameState {
|
|||
g.translate(0, dt * dt * container.getHeight());
|
||||
Vec2f rotationCenter = gameObj.getPointAt(beatmap.objects[idx].getTime());
|
||||
g.rotate(rotationCenter.x, rotationCenter.y, rotSpeed * dt);
|
||||
gameObj.draw(g, trackPosition);
|
||||
gameObj.draw(g, trackPosition, false);
|
||||
|
||||
g.popTransform();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user