Merge pull request #152 from mad-s/master

Draw reversing arrow in black if the slider is lightly colored
This commit is contained in:
Jeffrey Han 2015-11-22 12:35:04 -05:00
commit c10b5dd199

View File

@ -234,6 +234,8 @@ public class Slider implements GameObject {
for (int tcurRepeat = currentRepeats; tcurRepeat <= currentRepeats + 1; tcurRepeat++) { for (int tcurRepeat = currentRepeats; tcurRepeat <= currentRepeats + 1; tcurRepeat++) {
if (hitObject.getRepeatCount() - 1 > tcurRepeat) { if (hitObject.getRepeatCount() - 1 > tcurRepeat) {
Image arrow = GameImage.REVERSEARROW.getImage(); Image arrow = GameImage.REVERSEARROW.getImage();
float colorLuminance = 0.299f*color.r + 0.587f*color.g + 0.114f*color.b;
Color arrowColor = colorLuminance < 0.8f ? Color.white : Color.black;
if (tcurRepeat != currentRepeats) { if (tcurRepeat != currentRepeats) {
if (sliderTime == 0) if (sliderTime == 0)
continue; continue;
@ -244,11 +246,11 @@ public class Slider implements GameObject {
if (tcurRepeat % 2 == 0) { if (tcurRepeat % 2 == 0) {
// last circle // last circle
arrow.setRotation(curve.getEndAngle()); arrow.setRotation(curve.getEndAngle());
arrow.drawCentered(endPos.x, endPos.y); arrow.drawCentered(endPos.x, endPos.y, arrowColor);
} else { } else {
// first circle // first circle
arrow.setRotation(curve.getStartAngle()); arrow.setRotation(curve.getStartAngle());
arrow.drawCentered(x, y); arrow.drawCentered(x, y, arrowColor);
} }
} }
} }