Option to apply last object color to cursor
This commit is contained in:
parent
add5e96af1
commit
f6b791cf25
|
@ -694,7 +694,7 @@ public class Options {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED ("Object color override", "ObjColorOverride", "Override object colors") {
|
DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED ("Collage object color override", "ObjColorMirroredOverride", "Override collage object colors") {
|
||||||
@Override
|
@Override
|
||||||
public String getValueString() {
|
public String getValueString() {
|
||||||
return Dancer.colorMirrorOverride.toString();
|
return Dancer.colorMirrorOverride.toString();
|
||||||
|
@ -740,6 +740,20 @@ public class Options {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
DANCE_CURSOR_USE_OBJECT_COLOR ("Give object color to cursor", "CursorUseObjectColor", "The color of the last object will be used on the cursor", false) {
|
||||||
|
@Override
|
||||||
|
public void click(GameContainer container) {
|
||||||
|
bool = !bool;
|
||||||
|
Dancer.cursoruselastobjectcolor = bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(String s) {
|
||||||
|
super.read(s);
|
||||||
|
Dancer.cursoruselastobjectcolor = bool;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
DANCE_REMOVE_BG ("Never draw background", "RemoveBG", "Hello darkness my old friend", true) {
|
DANCE_REMOVE_BG ("Never draw background", "RemoveBG", "Hello darkness my old friend", true) {
|
||||||
@Override
|
@Override
|
||||||
public void click(GameContainer container) {
|
public void click(GameContainer container) {
|
||||||
|
|
|
@ -240,4 +240,14 @@ public class Circle extends GameObject {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getMirroredColor() {
|
||||||
|
return mirrorColor;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package itdelatrisu.opsu.objects;
|
||||||
import itdelatrisu.opsu.beatmap.HitObject;
|
import itdelatrisu.opsu.beatmap.HitObject;
|
||||||
import itdelatrisu.opsu.objects.curves.Vec2f;
|
import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||||
|
|
||||||
|
import org.newdawn.slick.Color;
|
||||||
import org.newdawn.slick.Graphics;
|
import org.newdawn.slick.Graphics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,4 +84,14 @@ public class DummyObject extends GameObject {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getColor() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getMirroredColor() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ package itdelatrisu.opsu.objects;
|
||||||
|
|
||||||
import itdelatrisu.opsu.objects.curves.Vec2f;
|
import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||||
|
|
||||||
|
import org.newdawn.slick.Color;
|
||||||
import org.newdawn.slick.Graphics;
|
import org.newdawn.slick.Graphics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,4 +98,7 @@ public abstract class GameObject {
|
||||||
public abstract boolean isSlider();
|
public abstract boolean isSlider();
|
||||||
public abstract boolean isSpinner();
|
public abstract boolean isSpinner();
|
||||||
|
|
||||||
|
public abstract Color getColor();
|
||||||
|
public abstract Color getMirroredColor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -650,4 +650,14 @@ public class Slider extends GameObject {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getMirroredColor() {
|
||||||
|
return mirrorColor;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,4 +428,14 @@ public class Spinner extends GameObject {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getColor() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getMirroredColor() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ public class Game extends BasicGameState {
|
||||||
|
|
||||||
public Game(int state) {
|
public Game(int state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
mirrorCursor = new Cursor();
|
mirrorCursor = new Cursor(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -876,6 +876,11 @@ public class Game extends BasicGameState {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GameObject g = gameObjects[objectIndex];
|
||||||
|
if (g.isCircle() || g.isSlider() && g.getTime() <= trackPosition) {
|
||||||
|
Cursor.lastObjColor = g.getColor();
|
||||||
|
Cursor.lastMirroredObjColor = g.getMirroredColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1308,6 +1313,9 @@ public class Game extends BasicGameState {
|
||||||
throws SlickException {
|
throws SlickException {
|
||||||
// container.setMouseGrabbed(false);
|
// container.setMouseGrabbed(false);
|
||||||
|
|
||||||
|
Cursor.lastObjColor = Color.white;
|
||||||
|
Cursor.lastMirroredObjColor = Color.white;
|
||||||
|
|
||||||
// re-hide cursor
|
// re-hide cursor
|
||||||
if (GameMod.AUTO.isActive() || isReplay)
|
if (GameMod.AUTO.isActive() || isReplay)
|
||||||
UI.getCursor().hide();
|
UI.getCursor().hide();
|
||||||
|
|
|
@ -115,6 +115,7 @@ public class OptionsMenu extends BasicGameState {
|
||||||
GameOption.DANCE_OBJECT_COLOR_OVERRIDE,
|
GameOption.DANCE_OBJECT_COLOR_OVERRIDE,
|
||||||
GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED,
|
GameOption.DANCE_OBJECT_COLOR_OVERRIDE_MIRRORED,
|
||||||
GameOption.DANCE_RGB_INC,
|
GameOption.DANCE_RGB_INC,
|
||||||
|
GameOption.DANCE_CURSOR_USE_OBJECT_COLOR,
|
||||||
GameOption.DANCE_REMOVE_BG,
|
GameOption.DANCE_REMOVE_BG,
|
||||||
GameOption.DANCE_HIDE_UI,
|
GameOption.DANCE_HIDE_UI,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -32,11 +32,9 @@ import java.util.LinkedList;
|
||||||
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.LWJGLException;
|
import org.lwjgl.LWJGLException;
|
||||||
import org.newdawn.slick.GameContainer;
|
import org.newdawn.slick.*;
|
||||||
import org.newdawn.slick.Image;
|
|
||||||
import org.newdawn.slick.Input;
|
|
||||||
import org.newdawn.slick.SlickException;
|
|
||||||
import org.newdawn.slick.state.StateBasedGame;
|
import org.newdawn.slick.state.StateBasedGame;
|
||||||
|
import yugecin.opsudance.Dancer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates and draws the cursor.
|
* Updates and draws the cursor.
|
||||||
|
@ -49,7 +47,7 @@ public class Cursor {
|
||||||
private Point lastPosition;
|
private Point lastPosition;
|
||||||
|
|
||||||
/** Cursor rotation angle. */
|
/** Cursor rotation angle. */
|
||||||
private float cursorAngle = 0f;
|
private static float cursorAngle = 0f;
|
||||||
|
|
||||||
/** The time in milliseconds when the cursor was last pressed, used for the scaling animation. */
|
/** The time in milliseconds when the cursor was last pressed, used for the scaling animation. */
|
||||||
private long lastCursorPressTime = 0L;
|
private long lastCursorPressTime = 0L;
|
||||||
|
@ -71,6 +69,11 @@ public class Cursor {
|
||||||
private static StateBasedGame game;
|
private static StateBasedGame game;
|
||||||
private static Input input;
|
private static Input input;
|
||||||
|
|
||||||
|
public static Color lastObjColor = Color.white;
|
||||||
|
public static Color lastMirroredObjColor = Color.white;
|
||||||
|
|
||||||
|
private boolean isMirrored;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the class.
|
* Initializes the class.
|
||||||
* @param container the game container
|
* @param container the game container
|
||||||
|
@ -95,7 +98,12 @@ public class Cursor {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public Cursor() {
|
public Cursor() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cursor(boolean isMirrored) {
|
||||||
resetLocations();
|
resetLocations();
|
||||||
|
this.isMirrored = isMirrored;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,6 +190,8 @@ public class Cursor {
|
||||||
for (int i = 0; i < removeCount && !trail.isEmpty(); i++)
|
for (int i = 0; i < removeCount && !trail.isEmpty(); i++)
|
||||||
trail.remove();
|
trail.remove();
|
||||||
|
|
||||||
|
Color filter = getColorFilter();
|
||||||
|
|
||||||
// draw a fading trail
|
// draw a fading trail
|
||||||
float alpha = 0f;
|
float alpha = 0f;
|
||||||
float t = 2f / trail.size();
|
float t = 2f / trail.size();
|
||||||
|
@ -190,7 +200,7 @@ public class Cursor {
|
||||||
cursorTrail.startUse();
|
cursorTrail.startUse();
|
||||||
for (Point p : trail) {
|
for (Point p : trail) {
|
||||||
alpha += t;
|
alpha += t;
|
||||||
cursorTrail.setImageColor(1f, 1f, 1f, alpha);
|
cursorTrail.setImageColor(filter.r, filter.g, filter.b, alpha);
|
||||||
cursorTrail.drawEmbedded(
|
cursorTrail.drawEmbedded(
|
||||||
p.x - (cursorTrailWidth / 2f), p.y - (cursorTrailHeight / 2f),
|
p.x - (cursorTrailWidth / 2f), p.y - (cursorTrailHeight / 2f),
|
||||||
cursorTrailWidth, cursorTrailHeight, cursorTrailRotation);
|
cursorTrailWidth, cursorTrailHeight, cursorTrailRotation);
|
||||||
|
@ -203,9 +213,19 @@ public class Cursor {
|
||||||
// draw the other components
|
// draw the other components
|
||||||
if (newStyle && skin.isCursorRotated())
|
if (newStyle && skin.isCursorRotated())
|
||||||
cursor.setRotation(cursorAngle);
|
cursor.setRotation(cursorAngle);
|
||||||
cursor.drawCentered(mouseX, mouseY);
|
cursor.drawCentered(mouseX, mouseY, filter);
|
||||||
if (hasMiddle)
|
if (hasMiddle)
|
||||||
cursorMiddle.drawCentered(mouseX, mouseY);
|
cursorMiddle.drawCentered(mouseX, mouseY, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color getColorFilter() {
|
||||||
|
if (!Dancer.cursoruselastobjectcolor) {
|
||||||
|
return Color.white;
|
||||||
|
}
|
||||||
|
if (isMirrored) {
|
||||||
|
return lastMirroredObjColor;
|
||||||
|
}
|
||||||
|
return lastObjColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class Dancer {
|
||||||
public static ObjectColorOverrides colorOverride = ObjectColorOverrides.NONE;
|
public static ObjectColorOverrides colorOverride = ObjectColorOverrides.NONE;
|
||||||
public static ObjectColorOverrides colorMirrorOverride = ObjectColorOverrides.NONE;
|
public static ObjectColorOverrides colorMirrorOverride = ObjectColorOverrides.NONE;
|
||||||
public static int rgbhueinc = 70; // this should really get its own place somewhere...
|
public static int rgbhueinc = 70; // this should really get its own place somewhere...
|
||||||
|
public static boolean cursoruselastobjectcolor;
|
||||||
|
|
||||||
private int dir;
|
private int dir;
|
||||||
private GameObject p;
|
private GameObject p;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user