shift hue on each new object
This commit is contained in:
@@ -23,6 +23,7 @@ import itdelatrisu.opsu.audio.SoundEffect;
|
|||||||
import itdelatrisu.opsu.beatmap.HitObject;
|
import itdelatrisu.opsu.beatmap.HitObject;
|
||||||
import itdelatrisu.opsu.downloads.Download;
|
import itdelatrisu.opsu.downloads.Download;
|
||||||
import itdelatrisu.opsu.downloads.DownloadNode;
|
import itdelatrisu.opsu.downloads.DownloadNode;
|
||||||
|
import itdelatrisu.opsu.objects.Circle;
|
||||||
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
||||||
import itdelatrisu.opsu.ui.Fonts;
|
import itdelatrisu.opsu.ui.Fonts;
|
||||||
import itdelatrisu.opsu.ui.UI;
|
import itdelatrisu.opsu.ui.UI;
|
||||||
@@ -576,6 +577,7 @@ public class Utils {
|
|||||||
return y < Options.height / 2d ? 1 : 4;
|
return y < Options.height / 2d ? 1 : 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public static Color shiftHue(Color color, double H) {
|
public static Color shiftHue(Color color, double H) {
|
||||||
double U = Math.cos(H * Math.PI / 180d);
|
double U = Math.cos(H * Math.PI / 180d);
|
||||||
double W = Math.sin(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.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);
|
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;
|
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. */
|
/** Whether or not the circle result ends the combo streak. */
|
||||||
private boolean comboEnd;
|
private boolean comboEnd;
|
||||||
|
|
||||||
|
public static int hue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Circle data type with map modifiers, images, and dimensions.
|
* Initializes the Circle data type with map modifiers, images, and dimensions.
|
||||||
* @param container the game container
|
* @param container the game container
|
||||||
@@ -87,13 +89,15 @@ public class Circle extends GameObject {
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
this.comboEnd = comboEnd;
|
this.comboEnd = comboEnd;
|
||||||
updatePosition();
|
updatePosition();
|
||||||
|
this.color = Utils.nextColor();
|
||||||
|
System.out.println(this.color.getRed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||||
Color orig = color;
|
Color orig = color;
|
||||||
if (mirror) {
|
if (mirror) {
|
||||||
color = Utils.shiftHue(color, 180d);
|
color = Utils.currentShiftColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
int timeDiff = hitObject.getTime() - trackPosition;
|
int timeDiff = hitObject.getTime() - trackPosition;
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ public class Slider extends GameObject {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.comboEnd = comboEnd;
|
this.comboEnd = comboEnd;
|
||||||
|
this.color = Utils.nextColor();
|
||||||
updatePosition();
|
updatePosition();
|
||||||
|
|
||||||
// slider time calculations
|
// slider time calculations
|
||||||
@@ -183,7 +184,7 @@ public class Slider extends GameObject {
|
|||||||
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
public void draw(Graphics g, int trackPosition, boolean mirror) {
|
||||||
Color orig = color;
|
Color orig = color;
|
||||||
if (mirror) {
|
if (mirror) {
|
||||||
color = Utils.shiftHue(color, 180d);
|
color = Utils.currentShiftColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
int timeDiff = hitObject.getTime() - trackPosition;
|
int timeDiff = hitObject.getTime() - trackPosition;
|
||||||
|
|||||||
Reference in New Issue
Block a user