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 <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-03-31 19:46:58 -04:00
parent 1d9ec52c8a
commit 66bd97242f
4 changed files with 10 additions and 6 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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++) {

View File

@ -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);
}
}