From 78511737ce9f9cec1e1a950d447a8035e82cf033 Mon Sep 17 00:00:00 2001 From: MatteoS Date: Sat, 21 Nov 2015 15:30:25 +0100 Subject: [PATCH] Draw reversing arrow in black if the slider is lightly colored --- src/itdelatrisu/opsu/objects/Slider.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 2676686e..888bdaec 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -234,6 +234,8 @@ public class Slider implements GameObject { for (int tcurRepeat = currentRepeats; tcurRepeat <= currentRepeats + 1; tcurRepeat++) { if (hitObject.getRepeatCount() - 1 > tcurRepeat) { 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 (sliderTime == 0) continue; @@ -244,11 +246,11 @@ public class Slider implements GameObject { if (tcurRepeat % 2 == 0) { // last circle arrow.setRotation(curve.getEndAngle()); - arrow.drawCentered(endPos.x, endPos.y); + arrow.drawCentered(endPos.x, endPos.y, arrowColor); } else { // first circle arrow.setRotation(curve.getStartAngle()); - arrow.drawCentered(x, y); + arrow.drawCentered(x, y, arrowColor); } } }