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 {
|
||||||
|
|
||||||
@@ -21,10 +24,18 @@ public class GuiTrimPart extends GuiStudioPart {
|
|||||||
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
|
||||||
@@ -102,11 +113,22 @@ public class GuiTrimPart extends GuiStudioPart {
|
|||||||
|
|
||||||
@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