multiple replay display stuff

This commit is contained in:
yugecin
2017-02-25 23:05:41 +01:00
parent e889e0f79f
commit ba2aa51b7b
5 changed files with 196 additions and 2 deletions

View File

@@ -485,7 +485,7 @@ public class Options {
screenshotFormatIndex = i;
}
},
CURSOR_SIZE ("Size", "CursorSize", "Change the cursor scale.", 100, 50, 200) {
CURSOR_SIZE ("Size", "CursorSize", "Change the cursor scale.", 100, 10, 200) {
@Override
public String getValueString() { return String.format("%.2fx", val / 100f); }

View File

@@ -51,10 +51,13 @@ import itdelatrisu.opsu.ui.animations.AnimatedValue;
import itdelatrisu.opsu.ui.animations.AnimationEquation;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.Animation;
import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
@@ -735,6 +738,15 @@ public class Game extends ComplexOpsuState {
UI.draw(g);
int i = 0;
g.setColor(new Color(0.2f, 0.2f, 0.2f));
g.fillRect(0, 0, ReplayPlayback.SQSIZE * 2, displayContainer.height);
g.setColor(Color.black);
g.fillRect(ReplayPlayback.SQSIZE * 2, 0, ReplayPlayback.SQSIZE * 2, displayContainer.height);
for (ReplayPlayback replayPlayback : replays) {
replayPlayback.render(displayContainer.renderDelta, g, i++, trackPosition);
}
super.render(g);
}
@@ -926,6 +938,7 @@ public class Game extends ComplexOpsuState {
// set mouse coordinates
autoMousePosition.set(autoPoint.x, autoPoint.y);
autoMousePosition.set(-100, -100);
}
if (isReplay) {
@@ -1444,6 +1457,7 @@ public class Game extends ComplexOpsuState {
return true;
}
private LinkedList<ReplayPlayback> replays;
@Override
public void enter() {
overlays.clear();
@@ -1457,6 +1471,29 @@ public class Game extends ComplexOpsuState {
super.enter();
File replaydir = new File("d:/Users/Robin/games/osu/osr-stuff-master/opsud/");
File[] files = replaydir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.getName().endsWith(".osr");
}
});
replays = new LinkedList<>();
float hueshift = 360f / files.length;
float hue = 0;
for (File file : files) {
Replay r = new Replay(file);
try {
r.load();
} catch (IOException e) {
EventBus.post(new BubbleNotificationEvent("could not load replay " + file.getName(), BubbleNotificationEvent.COMMONCOLOR_RED));
continue;
}
replays.add(new ReplayPlayback(r, new Color(java.awt.Color.getHSBColor((hue) / 360f, 1.0f, 1.0f).getRGB())));
hue += hueshift;
}
if (isReplay || GameMod.AUTO.isActive() || GameMod.AUTOPILOT.isActive()) {
displayContainer.drawCursor = false;
}

View File

@@ -33,6 +33,7 @@ import java.io.File;
import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.opengl.renderer.Renderer;
import org.newdawn.slick.util.Log;
import yugecin.opsudance.core.inject.Inject;
import yugecin.opsudance.core.state.BaseOpsuState;
@@ -70,6 +71,9 @@ public class Splash extends BaseOpsuState {
return;
}
System.out.println(
Renderer.get().getClass()
);
inited = true;
thread = new Thread() {
@Override

View File

@@ -66,6 +66,8 @@ public class Cursor {
private boolean isMirrored;
private Color filter;
/**
* Constructor.
*/
@@ -78,6 +80,11 @@ public class Cursor {
this.isMirrored = isMirrored;
}
public Cursor(Color filter) {
this(false);
this.filter = filter;
}
/**
* Draws the cursor.
* @param mousePressed whether or not the mouse button is pressed
@@ -131,6 +138,10 @@ public class Cursor {
lastCursorColor = filter = Dancer.cursorColorOverride.getColor();
}
if (this.filter != null) {
filter = this.filter;
}
// draw a fading trail
float alpha = 0f;
float t = 2f / trail.size();
@@ -139,7 +150,7 @@ public class Cursor {
cursorTrail.startUse();
for (Point p : trail) {
alpha += t;
cursorTrail.setImageColor(filter.r, filter.g, filter.b, alpha);
cursorTrail.setImageColor(filter.r, filter.g, filter.b, alpha * 0.1f);
cursorTrail.drawEmbedded(
p.x - (cursorTrailWidth / 2f), p.y - (cursorTrailHeight / 2f),
cursorTrailWidth, cursorTrailHeight, cursorTrailRotation);