shift hue on each new object
This commit is contained in:
parent
bad3add7c4
commit
e126edbff7
|
@ -23,6 +23,7 @@ import itdelatrisu.opsu.audio.SoundEffect;
|
|||
import itdelatrisu.opsu.beatmap.HitObject;
|
||||
import itdelatrisu.opsu.downloads.Download;
|
||||
import itdelatrisu.opsu.downloads.DownloadNode;
|
||||
import itdelatrisu.opsu.objects.Circle;
|
||||
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
|
@ -576,6 +577,7 @@ public class Utils {
|
|||
return y < Options.height / 2d ? 1 : 4;
|
||||
}
|
||||
|
||||
/*
|
||||
public static Color shiftHue(Color color, double H) {
|
||||
double U = Math.cos(H * Math.PI / 180d);
|
||||
double W = Math.sin(H * Math.PI / 180d);
|
||||
|
@ -585,6 +587,15 @@ public class Utils {
|
|||
n.g = (float) ((0.299 + 0.299 * U - 0.328 * W) * color.r + (0.587d - 0.413 * U + 0.035 * W) * color.g + (0.114d - 0.114d * U - 0.292 * W) * color.b);
|
||||
n.b = (float) ((0.299d + 0.300d * U + 1.250d * W) * color.r + (0.587d - 0.585d * U + 1.050d * W) * color.g + (0.114 - 0.886 * U - 0.203 * W) * color.b);
|
||||
return n;
|
||||
}*/
|
||||
|
||||
public static Color nextColor() {
|
||||
Circle.hue += 10;
|
||||
return new Color(java.awt.Color.getHSBColor(Circle.hue / 360f, 1.0f, 1.0f).getRGB());
|
||||
}
|
||||
|
||||
public static Color currentShiftColor() {
|
||||
return new Color(java.awt.Color.getHSBColor((Circle.hue + 180f) / 360f, 1.0f, 1.0f).getRGB());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,6 +59,8 @@ public class Circle extends GameObject {
|
|||
/** Whether or not the circle result ends the combo streak. */
|
||||
private boolean comboEnd;
|
||||
|
||||
public static int hue;
|
||||
|
||||
/**
|
||||
* Initializes the Circle data type with map modifiers, images, and dimensions.
|
||||
* @param container the game container
|
||||
|
@ -87,13 +89,15 @@ public class Circle extends GameObject {
|
|||
this.color = color;
|
||||
this.comboEnd = comboEnd;
|
||||
updatePosition();
|
||||
this.color = Utils.nextColor();
|
||||
System.out.println(this.color.getRed());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||
Color orig = color;
|
||||
if (mirror) {
|
||||
color = Utils.shiftHue(color, 180d);
|
||||
color = Utils.currentShiftColor();
|
||||
}
|
||||
|
||||
int timeDiff = hitObject.getTime() - trackPosition;
|
||||
|
|
|
@ -159,6 +159,7 @@ public class Slider extends GameObject {
|
|||
this.data = data;
|
||||
this.color = color;
|
||||
this.comboEnd = comboEnd;
|
||||
this.color = Utils.nextColor();
|
||||
updatePosition();
|
||||
|
||||
// slider time calculations
|
||||
|
@ -183,7 +184,7 @@ public class Slider extends GameObject {
|
|||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||
Color orig = color;
|
||||
if (mirror) {
|
||||
color = Utils.shiftHue(color, 180d);
|
||||
color = Utils.currentShiftColor();
|
||||
}
|
||||
|
||||
int timeDiff = hitObject.getTime() - trackPosition;
|
||||
|
|
Loading…
Reference in New Issue
Block a user