Markers are now subclasses of Keyframe

Markers can now be moved and jumped to on the Replay Timeline
This commit is contained in:
CrushedPixel
2015-06-09 22:55:20 +02:00
parent d30ef19c89
commit b2ad52d5b6
13 changed files with 133 additions and 99 deletions

View File

@@ -1,8 +1,6 @@
package eu.crushedpixel.replaymod.gui.elements;
import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.holders.Marker;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@@ -27,11 +25,6 @@ public class GuiTimeline extends Gui implements GuiElement {
protected static final int BORDER_RIGHT = 4;
protected static final int BODY_WIDTH = TEXTURE_WIDTH - BORDER_LEFT - BORDER_RIGHT;
protected static final int MARKER_TEXTURE_X = 40;
protected static final int MARKER_TEXTURE_Y = 39;
protected static final int MARKER_TEXTURE_WIDTH = 5;
protected static final int MARKER_TEXTURE_HEIGHT = 5;
/**
* Current position of the cursor. Should normally be between 0 and {@link #timelineLength}.
*/
@@ -59,11 +52,6 @@ public class GuiTimeline extends Gui implements GuiElement {
*/
public boolean showMarkers;
/**
* Whether to draw indicators for Replay Markers.
*/
public boolean showMarkerIndicators = true;
protected final int positionX;
protected final int positionY;
protected final int width;
@@ -150,26 +138,6 @@ public class GuiTimeline extends Gui implements GuiElement {
}
}
if(showMarkerIndicators) {
double segmentLength = timelineLength * zoom;
for(Marker marker : ReplayHandler.getMarkers()) {
if(marker.getTimestamp() <= rightTime && marker.getTimestamp() >= leftTime) {
int textureX = MARKER_TEXTURE_X;
int textureY = MARKER_TEXTURE_Y;
int y = positionY;
int markerX = getMarkerX(marker.getTimestamp(), leftTime, bodyWidth, segmentLength);
if(ReplayHandler.isSelected(marker)) {
textureX += MARKER_TEXTURE_WIDTH;
}
rect(markerX - 2, y + HEIGHT - 3 - MARKER_TEXTURE_HEIGHT, textureX, textureY, MARKER_TEXTURE_WIDTH, MARKER_TEXTURE_HEIGHT);
}
}
}
drawTimelineCursor(leftTime, rightTime, bodyWidth);
}