Add tooltips to ingame buttons
This commit is contained in:
@@ -7,8 +7,10 @@ import de.johni0702.minecraft.gui.GuiRenderer;
|
||||
import de.johni0702.minecraft.gui.RenderInfo;
|
||||
import de.johni0702.minecraft.gui.container.AbstractGuiOverlay;
|
||||
import de.johni0702.minecraft.gui.container.GuiPanel;
|
||||
import de.johni0702.minecraft.gui.element.GuiElement;
|
||||
import de.johni0702.minecraft.gui.element.GuiSlider;
|
||||
import de.johni0702.minecraft.gui.element.GuiTexturedButton;
|
||||
import de.johni0702.minecraft.gui.element.GuiTooltip;
|
||||
import de.johni0702.minecraft.gui.element.advanced.IGuiTimeline;
|
||||
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
@@ -27,8 +29,20 @@ public class GuiReplayOverlay extends AbstractGuiOverlay<GuiReplayOverlay> {
|
||||
|
||||
public final GuiPanel topPanel = new GuiPanel(this)
|
||||
.setLayout(new HorizontalLayout(HorizontalLayout.Alignment.LEFT).setSpacing(5));
|
||||
public final GuiTexturedButton playPauseButton = new GuiTexturedButton().setSize(20, 20)
|
||||
.setTexture(ReplayMod.TEXTURE, TEXTURE_SIZE);
|
||||
public final GuiTexturedButton playPauseButton = new GuiTexturedButton() {
|
||||
@Override
|
||||
public GuiElement getTooltip(RenderInfo renderInfo) {
|
||||
GuiTooltip tooltip = (GuiTooltip) super.getTooltip(renderInfo);
|
||||
if (tooltip != null) {
|
||||
if (getTextureNormal().getY() == 0) { // Play button
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.unpause");
|
||||
} else { // Pause button
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.pause");
|
||||
}
|
||||
}
|
||||
return tooltip;
|
||||
}
|
||||
}.setSize(20, 20).setTexture(ReplayMod.TEXTURE, TEXTURE_SIZE).setTooltip(new GuiTooltip());
|
||||
public final GuiSlider speedSlider = new GuiSlider().setSize(100, 20).setSteps(37); // 0.0 is not included
|
||||
public final GuiMarkerTimeline timeline;
|
||||
|
||||
|
||||
@@ -70,8 +70,22 @@ public class GuiPathing {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
public final GuiTexturedButton playPauseButton = new GuiTexturedButton().setSize(20, 20)
|
||||
.setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE);
|
||||
public final GuiTexturedButton playPauseButton = new GuiTexturedButton() {
|
||||
@Override
|
||||
public GuiElement getTooltip(RenderInfo renderInfo) {
|
||||
GuiTooltip tooltip = (GuiTooltip) super.getTooltip(renderInfo);
|
||||
if (tooltip != null) {
|
||||
if (player.isActive()) {
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.pausepath");
|
||||
} else if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.playpathfromstart");
|
||||
} else {
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.playpath");
|
||||
}
|
||||
}
|
||||
return tooltip;
|
||||
}
|
||||
}.setSize(20, 20).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTooltip(new GuiTooltip());
|
||||
|
||||
public final GuiTexturedButton renderButton = new GuiTexturedButton().onClick(new Runnable() {
|
||||
@Override
|
||||
@@ -79,13 +93,46 @@ public class GuiPathing {
|
||||
if (!preparePathsForPlayback()) return;
|
||||
new GuiRenderSettings(replayHandler, mod.getCurrentTimeline()).display();
|
||||
}
|
||||
}).setSize(20, 20).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(40, 0);
|
||||
}).setSize(20, 20).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(40, 0)
|
||||
.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.ingame.menu.renderpath"));
|
||||
|
||||
public final GuiTexturedButton positionKeyframeButton = new GuiTexturedButton().setSize(20, 20)
|
||||
.setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE);
|
||||
public final GuiTexturedButton positionKeyframeButton = new GuiTexturedButton() {
|
||||
@Override
|
||||
public GuiElement getTooltip(RenderInfo renderInfo) {
|
||||
GuiTooltip tooltip = (GuiTooltip) super.getTooltip(renderInfo);
|
||||
if (tooltip != null) {
|
||||
if (getTextureNormal().getY() == 40) { // Add keyframe
|
||||
if (getTextureNormal().getX() == 0) { // Position
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.addposkeyframe");
|
||||
} else { // Spectator
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.addspeckeyframe");
|
||||
}
|
||||
} else { // Remove keyframe
|
||||
if (getTextureNormal().getX() == 0) { // Position
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.removeposkeyframe");
|
||||
} else { // Spectator
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.removespeckeyframe");
|
||||
}
|
||||
}
|
||||
}
|
||||
return tooltip;
|
||||
}
|
||||
}.setSize(20, 20).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTooltip(new GuiTooltip());
|
||||
|
||||
public final GuiTexturedButton timeKeyframeButton = new GuiTexturedButton().setSize(20, 20)
|
||||
.setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE);
|
||||
public final GuiTexturedButton timeKeyframeButton = new GuiTexturedButton() {
|
||||
@Override
|
||||
public GuiElement getTooltip(RenderInfo renderInfo) {
|
||||
GuiTooltip tooltip = (GuiTooltip) super.getTooltip(renderInfo);
|
||||
if (tooltip != null) {
|
||||
if (getTextureNormal().getY() == 80) { // Add time keyframe
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.addtimekeyframe");
|
||||
} else { // Remove time keyframe
|
||||
tooltip.setI18nText("replaymod.gui.ingame.menu.removetimekeyframe");
|
||||
}
|
||||
}
|
||||
return tooltip;
|
||||
}
|
||||
}.setSize(20, 20).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTooltip(new GuiTooltip());
|
||||
|
||||
public final GuiKeyframeTimeline timeline = new GuiKeyframeTimeline(this){
|
||||
@Override
|
||||
@@ -114,14 +161,16 @@ public class GuiPathing {
|
||||
public void run() {
|
||||
zoomTimeline(2d / 3d);
|
||||
}
|
||||
}).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(40, 20);
|
||||
}).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(40, 20)
|
||||
.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.ingame.menu.zoomin"));
|
||||
|
||||
public final GuiTexturedButton zoomOutButton = new GuiTexturedButton().setSize(9, 9).onClick(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
zoomTimeline(3d / 2d);
|
||||
}
|
||||
}).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(40, 30);
|
||||
}).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(40, 30)
|
||||
.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.ingame.menu.zoomout"));
|
||||
|
||||
public final GuiPanel zoomButtonPanel = new GuiPanel()
|
||||
.setLayout(new VerticalLayout(VerticalLayout.Alignment.CENTER).setSpacing(2))
|
||||
|
||||
Reference in New Issue
Block a user