/*
 * Copyright  2014 - 2017 | Wurst-Imperium | All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package net.wurstclient.gui.options;

import org.lwjgl.input.Keyboard;

import net.minecraft.client.gui.GuiScreen;

public class GuiPressAKey extends GuiScreen
{
	private GuiPressAKeyCallback prevMenu;
	
	public GuiPressAKey(GuiPressAKeyCallback prevMenu)
	{
		if(!(prevMenu instanceof GuiScreen))
			throw new IllegalArgumentException(
				"prevMenu is not an instance of GuiScreen");
		this.prevMenu = prevMenu;
	}
	
	/**
	 * Fired when a key is typed. This is the equivalent of
	 * KeyListener.keyTyped(KeyEvent e).
	 */
	@Override
	protected void keyTyped(char par1, int par2)
	{
		prevMenu.setKey(Keyboard.getKeyName(par2));
		mc.displayGuiScreen((GuiScreen)prevMenu);
	}
	
	/**
	 * Draws the screen and all the components in it.
	 */
	@Override
	public void drawScreen(int par1, int par2, float par3)
	{
		drawBackground(0);
		drawCenteredString(fontRendererObj, "Press a key", width / 2,
			height / 4 + 48, 16777215);
		super.drawScreen(par1, par2, par3);
	}
}

@@ -467,20 +467,22 @@
 ack prev
-M
+Scre
 en
-u
 ;%0A%09%0A%09pub
@@ -523,20 +523,22 @@
 ack prev
-M
+Scre
 en
-u
 )%0A%09%7B%0A%09%09i
@@ -545,20 +545,22 @@
 f(!(prev
-M
+Scre
 en
-u
  instanc
@@ -623,20 +623,22 @@
 %09%09%09%22prev
-M
+Scre
 en
-u
  is not 
@@ -680,23 +680,27 @@
 prev
-M
+Scre
 en
-u
  = prev
-M
+Scre
 en
-u
 ;%0A%09%7D
@@ -873,20 +873,22 @@
 %7B%0A%09%09prev
-M
+Scre
 en
-u
 .setKey(
@@ -956,12 +956,14 @@
 prev
-M
+Scre
 en
-u
 );%0A%09

Update GuiPressAKey