package MineGod;
import java.awt.Font;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.Color;
import org.newdawn.slick.TrueTypeFont;
import org.newdawn.slick.opengl.Texture;
public class GUILabelNameTyping extends GUILabel{
public static TrueTypeFont font;
public static String text = "";
public GUILabelNameTyping(){
x = 65;
y = 65;
text = "";
}
public static void addLetter(char c){
if(text.length() <= 11)
text = text+c;
}
public static void removeLetter(){
if(text.length() > 0){
text = text.substring(0, text.length()-1);
}
}
public static void loadTexture(){
Font awtFont = new Font("Times New Roman", Font.BOLD, 24);
font = new TrueTypeFont(awtFont, true);
}
public void render(double zIndex){
if (!hidden){
double boxWidth = 300;
double boxHeight = 32;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GL11.glBegin(GL11.GL_QUADS);
GL11.glNormal3d(0, 0, 1);
GL11.glVertex3d(x-4, y-4, zIndex+25);
GL11.glVertex3d(x-4 + boxWidth, y-4, zIndex+25);
GL11.glVertex3d(x-4 + boxWidth, y-4 + boxHeight, zIndex+25);
GL11.glVertex3d(x-4, y-4 + boxHeight, zIndex+25);
GL11.glEnd();
font.drawString((float)x, (float)y, text, Color.black);
}
}
@Override
public Texture getTexture() {
// TODO Auto-generated method stub
return null;
}
}