From 66bd97242f373d33e747a6e881547615988772f9 Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Tue, 31 Mar 2015 19:46:58 -0400 Subject: [PATCH] Minor follow-up to #63. Pass in an alpha level instead of color filter to drawSymbolNumber(). Also fixed a bug where antialiasing wasn't being disabled when it was supposed to be. Signed-off-by: Jeffrey Han --- src/itdelatrisu/opsu/GameData.java | 8 ++++++-- src/itdelatrisu/opsu/objects/Circle.java | 4 ++-- src/itdelatrisu/opsu/objects/Slider.java | 2 +- src/itdelatrisu/opsu/objects/Spinner.java | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/itdelatrisu/opsu/GameData.java b/src/itdelatrisu/opsu/GameData.java index 61fef9cd..254c25ac 100644 --- a/src/itdelatrisu/opsu/GameData.java +++ b/src/itdelatrisu/opsu/GameData.java @@ -443,14 +443,17 @@ public class GameData { * @param x the center x coordinate * @param y the center y coordinate * @param scale the scale to apply + * @param alpha the alpha level */ - public void drawSymbolNumber(int n, float x, float y, float scale, Color color) { + public void drawSymbolNumber(int n, float x, float y, float scale, float alpha) { int length = (int) (Math.log10(n) + 1); float digitWidth = getDefaultSymbolImage(0).getWidth() * scale; float cx = x + ((length - 1) * (digitWidth / 2)); for (int i = 0; i < length; i++) { - getDefaultSymbolImage(n % 10).getScaledCopy(scale).drawCentered(cx, y, color); + Image digit = getDefaultSymbolImage(n % 10).getScaledCopy(scale); + digit.setAlpha(alpha); + digit.drawCentered(cx, y); cx -= digitWidth; n /= 10; } @@ -576,6 +579,7 @@ public class GameData { -90 + (int) (360f * trackPosition / firstObjectTime), -90 ); } + g.setAntiAlias(false); } // mod icons diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index d6abac19..6380078c 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -95,12 +95,12 @@ public class Circle implements HitObject { float oldAlpha = Utils.COLOR_WHITE_FADE.a; Utils.COLOR_WHITE_FADE.a = color.a = alpha; - if(timeDiff >= 0 ) + if (timeDiff >= 0) GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color); GameImage.HITCIRCLE.getImage().drawCentered(x, y, color); GameImage.HITCIRCLE_OVERLAY.getImage().drawCentered(x, y, Utils.COLOR_WHITE_FADE); data.drawSymbolNumber(hitObject.getComboNumber(), x, y, - GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), Utils.COLOR_WHITE_FADE); + GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha); Utils.COLOR_WHITE_FADE.a = oldAlpha; } diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index c0c2a22c..646e8c12 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -198,7 +198,7 @@ public class Slider implements HitObject { ; // don't draw current combo number if already clicked else data.drawSymbolNumber(hitObject.getComboNumber(), x, y, - hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), Utils.COLOR_WHITE_FADE); + hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha); // repeats for (int tcurRepeat = currentRepeats; tcurRepeat <= currentRepeats + 1; tcurRepeat++) { diff --git a/src/itdelatrisu/opsu/objects/Spinner.java b/src/itdelatrisu/opsu/objects/Spinner.java index 2f078ec0..1200418a 100644 --- a/src/itdelatrisu/opsu/objects/Spinner.java +++ b/src/itdelatrisu/opsu/objects/Spinner.java @@ -168,7 +168,7 @@ public class Spinner implements HitObject { GameImage.SPINNER_CLEAR.getImage().drawCentered(width / 2, height / 4); int extraRotations = (int) (rotations - rotationsNeeded); if (extraRotations > 0) - data.drawSymbolNumber(extraRotations * 1000, width / 2, height * 2 / 3, 1.0f, Color.white); + data.drawSymbolNumber(extraRotations * 1000, width / 2, height * 2 / 3, 1f, 1f); } }