Subtle fade in effect for circles and sliders. (#9)
Also resize the "skip" button on hover. (follow-up 33f5df0
)
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
068a844e1f
commit
cc84d4a3e4
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>itdelatrisu</groupId>
|
||||
<artifactId>opsu</artifactId>
|
||||
<version>0.3.2</version>
|
||||
<version>0.3.3</version>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
|
|
|
@ -63,7 +63,8 @@ public class Utils {
|
|||
COLOR_BLUE_OBJECT = new Color(46, 136, 248),
|
||||
COLOR_RED_OBJECT = new Color(243, 48, 77),
|
||||
COLOR_ORANGE_OBJECT = new Color(255, 200, 32),
|
||||
COLOR_YELLOW_ALPHA = new Color(255, 255, 0, 0.4f);
|
||||
COLOR_YELLOW_ALPHA = new Color(255, 255, 0, 0.4f),
|
||||
COLOR_WHITE_FADE = new Color(255, 255, 255, 1f);
|
||||
|
||||
/**
|
||||
* The default map colors, used when a map does not provide custom colors.
|
||||
|
|
|
@ -100,8 +100,13 @@ public class Circle {
|
|||
float x = hitObject.getX(), y = hitObject.getY();
|
||||
float approachScale = 1 + (timeDiff * 2f / game.getApproachTime());
|
||||
Utils.drawCentered(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale), x, y, color);
|
||||
Utils.drawCentered(GameImage.HITCIRCLE_OVERLAY.getImage(), x, y, Color.white);
|
||||
float alpha = (approachScale > 3.3f) ? 0f : 1f - (approachScale - 1f) / 2.7f;
|
||||
color.a = alpha;
|
||||
Utils.COLOR_WHITE_FADE.a = alpha;
|
||||
Utils.drawCentered(GameImage.HITCIRCLE_OVERLAY.getImage(), x, y, Utils.COLOR_WHITE_FADE);
|
||||
Utils.drawCentered(GameImage.HITCIRCLE.getImage(), x, y, color);
|
||||
color.a = 1f;
|
||||
Utils.COLOR_WHITE_FADE.a = 1f;
|
||||
score.drawSymbolNumber(hitObject.getComboNumber(), x, y,
|
||||
GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / score.getDefaultSymbolImage(0).getHeight());
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ public class Slider {
|
|||
|
||||
// draw overlay and hit circle
|
||||
for (int i = curveX.length - 1; i >= 0; i--)
|
||||
Utils.drawCentered(hitCircleOverlay, curveX[i], curveY[i], Color.white);
|
||||
Utils.drawCentered(hitCircleOverlay, curveX[i], curveY[i], Utils.COLOR_WHITE_FADE);
|
||||
for (int i = curveX.length - 1; i >= 0; i--)
|
||||
Utils.drawCentered(hitCircle, curveX[i], curveY[i], color);
|
||||
}
|
||||
|
@ -345,27 +345,33 @@ public class Slider {
|
|||
float[] sliderX = hitObject.getSliderX(), sliderY = hitObject.getSliderY();
|
||||
int timeDiff = hitObject.getTime() - trackPosition;
|
||||
|
||||
Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
|
||||
Image hitCircle = GameImage.HITCIRCLE.getImage();
|
||||
float approachScale = (timeDiff >= 0) ? 1 + (timeDiff * 2f / game.getApproachTime()) : 1f;
|
||||
float alpha = (approachScale > 3.3f) ? 0f : 1f - (approachScale - 1f) / 2.7f;
|
||||
color.a = alpha;
|
||||
Utils.COLOR_WHITE_FADE.a = alpha;
|
||||
|
||||
// bezier
|
||||
bezier.draw();
|
||||
|
||||
// ticks
|
||||
if (currentObject && ticksT != null) {
|
||||
Image tick = GameImage.SLIDER_TICK.getImage();
|
||||
for (int i = 0; i < ticksT.length; i++) {
|
||||
float[] c = bezier.pointAt(ticksT[i]);
|
||||
GameImage.SLIDER_TICK.getImage().drawCentered(c[0], c[1]);
|
||||
tick.drawCentered(c[0], c[1]);
|
||||
}
|
||||
}
|
||||
|
||||
Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
|
||||
Image hitCircle = GameImage.HITCIRCLE.getImage();
|
||||
|
||||
// end circle
|
||||
int lastIndex = sliderX.length - 1;
|
||||
Utils.drawCentered(hitCircleOverlay, sliderX[lastIndex], sliderY[lastIndex], Color.white);
|
||||
Utils.drawCentered(hitCircleOverlay, sliderX[lastIndex], sliderY[lastIndex], Utils.COLOR_WHITE_FADE);
|
||||
Utils.drawCentered(hitCircle, sliderX[lastIndex], sliderY[lastIndex], color);
|
||||
|
||||
// start circle
|
||||
Utils.drawCentered(hitCircleOverlay, x, y, Color.white);
|
||||
Utils.drawCentered(hitCircleOverlay, x, y, Utils.COLOR_WHITE_FADE);
|
||||
Utils.drawCentered(hitCircle, x, y, color);
|
||||
if (sliderClicked)
|
||||
; // don't draw current combo number if already clicked
|
||||
|
@ -373,9 +379,13 @@ public class Slider {
|
|||
score.drawSymbolNumber(hitObject.getComboNumber(), x, y,
|
||||
hitCircle.getWidth() * 0.40f / score.getDefaultSymbolImage(0).getHeight());
|
||||
|
||||
color.a = 1f;
|
||||
Utils.COLOR_WHITE_FADE.a = 1f;
|
||||
|
||||
// repeats
|
||||
if (hitObject.getRepeatCount() - 1 > currentRepeats) {
|
||||
Image arrow = GameImage.REVERSEARROW.getImage();
|
||||
arrow.setAlpha(alpha);
|
||||
if (currentRepeats % 2 == 0) { // last circle
|
||||
arrow.setRotation(bezier.getEndAngle());
|
||||
arrow.drawCentered(sliderX[lastIndex], sliderY[lastIndex]);
|
||||
|
@ -383,11 +393,11 @@ public class Slider {
|
|||
arrow.setRotation(bezier.getStartAngle());
|
||||
arrow.drawCentered(x, y);
|
||||
}
|
||||
arrow.setAlpha(1f);
|
||||
}
|
||||
|
||||
if (timeDiff >= 0) {
|
||||
// approach circle
|
||||
float approachScale = 1 + (timeDiff * 2f / game.getApproachTime());
|
||||
Utils.drawCentered(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale), x, y, color);
|
||||
} else {
|
||||
float[] c = bezier.pointAt(getT(trackPosition, false));
|
||||
|
|
|
@ -424,6 +424,8 @@ public class Game extends BasicGameState {
|
|||
public void update(GameContainer container, StateBasedGame game, int delta)
|
||||
throws SlickException {
|
||||
Utils.updateCursor(delta);
|
||||
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
||||
skipButton.hoverUpdate(delta, mouseX, mouseY);
|
||||
|
||||
if (isLeadIn()) { // stop updating during song lead-in
|
||||
leadInTime -= delta;
|
||||
|
@ -521,8 +523,8 @@ public class Game extends BasicGameState {
|
|||
// pause game if focus lost
|
||||
if (!container.hasFocus() && !GameMod.AUTO.isActive()) {
|
||||
if (pauseTime < 0) {
|
||||
pausedMouseX = input.getMouseX();
|
||||
pausedMouseY = input.getMouseY();
|
||||
pausedMouseX = mouseX;
|
||||
pausedMouseY = mouseY;
|
||||
pausePulse = 0f;
|
||||
}
|
||||
if (MusicController.isPlaying() || isLeadIn())
|
||||
|
@ -563,9 +565,9 @@ public class Game extends BasicGameState {
|
|||
if (hitObject.isCircle())
|
||||
done = circles.get(objectIndex).update(overlap);
|
||||
else if (hitObject.isSlider())
|
||||
done = sliders.get(objectIndex).update(overlap, delta, input.getMouseX(), input.getMouseY());
|
||||
done = sliders.get(objectIndex).update(overlap, delta, mouseX, mouseY);
|
||||
else if (hitObject.isSpinner())
|
||||
done = spinners.get(objectIndex).update(overlap, delta, input.getMouseX(), input.getMouseY());
|
||||
done = spinners.get(objectIndex).update(overlap, delta, mouseX, mouseY);
|
||||
|
||||
// increment object index?
|
||||
if (done)
|
||||
|
@ -789,6 +791,8 @@ public class Game extends BasicGameState {
|
|||
leadInTime = osu.audioLeadIn + approachTime;
|
||||
restart = RESTART_FALSE;
|
||||
}
|
||||
|
||||
skipButton.setScale(1f);
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
@ -842,6 +846,7 @@ public class Game extends BasicGameState {
|
|||
skipButton = new GUIMenuButton(skip,
|
||||
width - (skip.getWidth() / 2f),
|
||||
height - (skip.getHeight() / 2f));
|
||||
skipButton.setHoverDir(GUIMenuButton.Expand.UP_LEFT);
|
||||
|
||||
// countdown
|
||||
float countdownHeight = height / 3f;
|
||||
|
|
Loading…
Reference in New Issue
Block a user