Added TooltipRenderer to mimic Item Tooltip Rendering for hover texts and replaced some error/info messages to use the TooltipRenderer
This commit is contained in:
@@ -278,15 +278,15 @@ public class GuiPlayerOverview extends GuiScreen implements GuiReplayOverlay.NoO
|
||||
rememberHidden.drawButton(mc, mouseX, mouseY);
|
||||
|
||||
if(hideAllBox.isMouseOver()) {
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.playeroverview.hideall"), mouseX, mouseY+5, Color.WHITE.getRGB());
|
||||
ReplayMod.tooltipRenderer.drawTooltip(mouseX, mouseY, I18n.format("replaymod.gui.playeroverview.hideall"), this, Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
if(showAllBox.isMouseOver()) {
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.playeroverview.showall"), mouseX, mouseY+5, Color.WHITE.getRGB());
|
||||
ReplayMod.tooltipRenderer.drawTooltip(mouseX, mouseY, I18n.format("replaymod.gui.playeroverview.showall"), this, Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
if(rememberHidden.isMouseOver()) {
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.playeroverview.remembersettings.description"), mouseX, mouseY+5, Color.WHITE.getRGB());
|
||||
ReplayMod.tooltipRenderer.drawTooltip(mouseX, mouseY, I18n.format("replaymod.gui.playeroverview.remembersettings.description"), this, Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
//this is necessary to reset the GL parameters for further GUI rendering
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay.TEXTURE_SIZE;
|
||||
import static eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay.replay_gui;
|
||||
import static org.lwjgl.opengl.GL11.GL_BLEND;
|
||||
@@ -149,7 +152,7 @@ public class GuiTimeline extends Gui {
|
||||
if (mouseTime != -1) {
|
||||
long sec = mouseTime / 1000;
|
||||
String timestamp = String.format("%02d:%02ds", sec / 60, sec % 60);
|
||||
drawCenteredString(mc.fontRendererObj, timestamp, mouseX, mouseY + 5, 0xffffffff);
|
||||
ReplayMod.tooltipRenderer.drawTooltip(mouseX, mouseY, timestamp, null, Color.WHITE.getRGB());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
|
||||
|
||||
if(((favButton.isMouseOver() && !favButton.enabled) || (likeButton.isMouseOver() && !likeButton.enabled)
|
||||
|| (dislikeButton.isMouseOver() && !dislikeButton.enabled ))&& currentList.selected != -1) {
|
||||
this.drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.center.downloadrequired"), mouseX, mouseY + 4, Color.RED.getRGB());
|
||||
ReplayMod.tooltipRenderer.drawTooltip(mouseX, mouseY, I18n.format("replaymod.gui.center.downloadrequired"), this, Color.RED.getRGB());
|
||||
}
|
||||
|
||||
this.drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.replaycenter"), this.width / 2, 5, Color.WHITE.getRGB());
|
||||
|
||||
@@ -4,6 +4,7 @@ import eu.crushedpixel.replaymod.ReplayMod;
|
||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||
import eu.crushedpixel.replaymod.gui.elements.GuiDropdown;
|
||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||
import eu.crushedpixel.replaymod.utils.StringUtils;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -162,30 +163,11 @@ public class GuiReplayEditor extends GuiScreen {
|
||||
|
||||
drawCenteredString(fontRendererObj, "§n" + currentTab.getStudioPart().getTitle(), width / 2, 92, Color.WHITE.getRGB());
|
||||
|
||||
List<String> rows = new ArrayList<String>();
|
||||
String remaining = currentTab.getStudioPart().getDescription();
|
||||
while(remaining.length() > 0) {
|
||||
String[] split = remaining.split(" ");
|
||||
String b = "";
|
||||
for(String sp : split) {
|
||||
b += sp + " ";
|
||||
if(fontRendererObj.getStringWidth(b.trim()) > width - 30 - 70 - 20) {
|
||||
b = b.substring(0, b.trim().length() - (sp.length()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
String trimmed = b.trim();
|
||||
rows.add(trimmed);
|
||||
try {
|
||||
remaining = remaining.substring(trimmed.length() + 1);
|
||||
} catch(Exception e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
String[] rows = StringUtils.splitStringInMultipleRows(currentTab.getStudioPart().getDescription(), width - 30 - 70 - 20);
|
||||
|
||||
int i = 0;
|
||||
for(String row : rows) {
|
||||
drawString(fontRendererObj, row, 30, height - (15 * (rows.size() - i)), Color.WHITE.getRGB());
|
||||
drawString(fontRendererObj, row, 30, height - (15 * (rows.length - i)), Color.WHITE.getRGB());
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,10 +154,10 @@ public class GuiReplayViewer extends GuiScreen implements GuiYesNoCallback {
|
||||
if(uploadButton.isMouseOver() && !uploadButton.enabled && loadButton.enabled) {
|
||||
if(!AuthenticationHandler.isAuthenticated()) {
|
||||
Point mouse = MouseUtils.getMousePos();
|
||||
drawCenteredString(mc.fontRendererObj, I18n.format("replaymod.gui.viewer.noauth"), (int) mouse.getX(), (int) mouse.getY() + 4, Color.RED.getRGB());
|
||||
ReplayMod.tooltipRenderer.drawTooltip(mouseX, mouseY, I18n.format("replaymod.gui.viewer.noauth"), this, Color.RED.getRGB());
|
||||
} else if(currentFileUploaded) {
|
||||
Point mouse = MouseUtils.getMousePos();
|
||||
drawCenteredString(mc.fontRendererObj, I18n.format("replaymod.gui.viewer.alreadyuploaded"), (int) mouse.getX(), (int) mouse.getY() + 4, Color.RED.getRGB());
|
||||
ReplayMod.tooltipRenderer.drawTooltip(mouseX, mouseY, I18n.format("replaymod.gui.viewer.alreadyuploaded"), this, Color.RED.getRGB());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user