package net.tylermurphy.Minecraft.Input; import org.lwjgl.glfw.GLFW; import net.tylermurphy.Minecraft.Command.CommandHandler; import net.tylermurphy.Minecraft.Scene.World; import static net.tylermurphy.Minecraft.UI.UIMaster.*; public class CommandInput extends IInput { public void keyPressed(int keyCode) { switch(keyCode) { case GLFW.GLFW_KEY_ESCAPE: Input.setEnabled("CommandInput", false); Input.setEnabled("GameInput", true); bindUI(3); setEnabled(false); getText("commandBar").setText(""); World.player.isPaused = false; break; case GLFW.GLFW_KEY_BACKSPACE: bindUI(3); String currentText = getText("commandBar").getTextString(); if(currentText.length() > 0) getText("commandBar").setText(currentText.substring(0,currentText.length()-1)); break; case GLFW.GLFW_KEY_ENTER: bindUI(3); setEnabled(false); String command = getText("commandBar").getTextString(); CommandHandler.handleCommand(command); Input.setEnabled("CommandInput", false); Input.setEnabled("GameInput", true); getText("commandBar").setText(""); World.player.isPaused = false; break; } } public void keyRelesed(int keyCode) {} public void mousePressed(int mouseButton) {} public void mouseRelesed(int mouseButton) {} public void charAction(char c) { bindUI(3); String currentText = getText("commandBar").getTextString(); currentText += c; getText("commandBar").setText(currentText); } }