Use component like system for gui overlay

Add missing abort path replay button
This commit is contained in:
johni0702
2015-05-31 20:48:04 +02:00
parent 53bb338d1b
commit b3451ed7fd
11 changed files with 443 additions and 183 deletions

View File

@@ -11,7 +11,7 @@ import static eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay.replay_gui;
import static org.lwjgl.opengl.GL11.GL_BLEND;
import static org.lwjgl.opengl.GL11.glEnable;
public class GuiTimeline extends Gui {
public class GuiTimeline extends Gui implements GuiElement {
protected static final int TEXTURE_WIDTH = 64;
protected static final int BORDER_TOP = 4;
@@ -146,7 +146,10 @@ public class GuiTimeline extends Gui {
rect(cursorX - 2, positionY + BORDER_TOP, 84, 20, 5, 16);
}
}
@Override
public void drawOverlay(Minecraft mc, int mouseX, int mouseY) {
// Draw time under cursor if the mouse is on the timeline
long mouseTime = getTimeAt(mouseX, mouseY);
if (mouseTime != -1) {
@@ -156,6 +159,26 @@ public class GuiTimeline extends Gui {
}
}
@Override
public boolean isHovering(int mouseX, int mouseY) {
return getTimeAt(mouseX, mouseY) != -1;
}
@Override
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
}
@Override
public void mouseDrag(Minecraft mc, int mouseX, int mouseY, int button) {
}
@Override
public void mouseRelease(Minecraft mc, int mouseX, int mouseY, int button) {
}
protected void rect(int x, int y, int u, int v, int width, int height) {
Minecraft.getMinecraft().renderEngine.bindTexture(replay_gui);
glEnable(GL_BLEND);