Added Tab cycling to GuiTrimPart
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
package eu.crushedpixel.replaymod.gui.replaystudio;
|
package eu.crushedpixel.replaymod.gui.replaystudio;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.io.IOException;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import eu.crushedpixel.replaymod.gui.GuiNumberInput;
|
import eu.crushedpixel.replaymod.gui.GuiNumberInput;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
|
|
||||||
public class GuiTrimPart extends GuiStudioPart {
|
public class GuiTrimPart extends GuiStudioPart {
|
||||||
|
|
||||||
@@ -15,28 +18,36 @@ public class GuiTrimPart extends GuiStudioPart {
|
|||||||
|
|
||||||
private static final String DESCRIPTION = "Removes the beginning and end of a Replay File and only keeps the Replay between the given Timestamps";
|
private static final String DESCRIPTION = "Removes the beginning and end of a Replay File and only keeps the Replay between the given Timestamps";
|
||||||
private static final String TITLE = "Trim Replay";
|
private static final String TITLE = "Trim Replay";
|
||||||
|
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
|
|
||||||
private GuiNumberInput startMinInput, startSecInput, startMsInput;
|
private GuiNumberInput startMinInput, startSecInput, startMsInput;
|
||||||
private GuiNumberInput endMinInput, endSecInput, endMsInput;
|
private GuiNumberInput endMinInput, endSecInput, endMsInput;
|
||||||
|
|
||||||
|
private List<GuiNumberInput> inputOrder = new ArrayList<GuiNumberInput>();
|
||||||
|
|
||||||
public GuiTrimPart(int yPos) {
|
public GuiTrimPart(int yPos) {
|
||||||
this.yPos = yPos;
|
this.yPos = yPos;
|
||||||
fontRendererObj = mc.fontRendererObj;
|
fontRendererObj = mc.fontRendererObj;
|
||||||
initGui();
|
initGui();
|
||||||
|
inputOrder.add(startMinInput);
|
||||||
|
inputOrder.add(startSecInput);
|
||||||
|
inputOrder.add(startMsInput);
|
||||||
|
inputOrder.add(endMinInput);
|
||||||
|
inputOrder.add(endSecInput);
|
||||||
|
inputOrder.add(endMsInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyFilters() {
|
public void applyFilters() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return DESCRIPTION;
|
return DESCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return TITLE;
|
return TITLE;
|
||||||
@@ -77,14 +88,14 @@ public class GuiTrimPart extends GuiStudioPart {
|
|||||||
drawString(mc.fontRendererObj, "s", 150, yPos+7+30, Color.WHITE.getRGB());
|
drawString(mc.fontRendererObj, "s", 150, yPos+7+30, Color.WHITE.getRGB());
|
||||||
drawString(mc.fontRendererObj, "ms", 200, yPos+7, Color.WHITE.getRGB());
|
drawString(mc.fontRendererObj, "ms", 200, yPos+7, Color.WHITE.getRGB());
|
||||||
drawString(mc.fontRendererObj, "ms", 200, yPos+7+30, Color.WHITE.getRGB());
|
drawString(mc.fontRendererObj, "ms", 200, yPos+7+30, Color.WHITE.getRGB());
|
||||||
|
|
||||||
startMinInput.drawTextBox();
|
startMinInput.drawTextBox();
|
||||||
startSecInput.drawTextBox();
|
startSecInput.drawTextBox();
|
||||||
startMsInput.drawTextBox();
|
startMsInput.drawTextBox();
|
||||||
endMinInput.drawTextBox();
|
endMinInput.drawTextBox();
|
||||||
endSecInput.drawTextBox();
|
endSecInput.drawTextBox();
|
||||||
endMsInput.drawTextBox();
|
endMsInput.drawTextBox();
|
||||||
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,14 +110,25 @@ public class GuiTrimPart extends GuiStudioPart {
|
|||||||
endMsInput.updateCursorCounter();
|
endMsInput.updateCursorCounter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyTyped(char typedChar, int keyCode) {
|
public void keyTyped(char typedChar, int keyCode) {
|
||||||
startMinInput.textboxKeyTyped(typedChar, keyCode);
|
if(keyCode == Keyboard.KEY_TAB) { //Tab handling
|
||||||
startSecInput.textboxKeyTyped(typedChar, keyCode);
|
int i=0;
|
||||||
startMsInput.textboxKeyTyped(typedChar, keyCode);
|
for(GuiNumberInput input: inputOrder) {
|
||||||
endMinInput.textboxKeyTyped(typedChar, keyCode);
|
if(input.isFocused()) {
|
||||||
endSecInput.textboxKeyTyped(typedChar, keyCode);
|
input.setFocused(false);
|
||||||
endMsInput.textboxKeyTyped(typedChar, keyCode);
|
i++;
|
||||||
|
if(i >= inputOrder.size()) i=0;
|
||||||
|
inputOrder.get(i).setFocused(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(GuiNumberInput input: inputOrder) {
|
||||||
|
input.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user