52 lines
987 B
Java
52 lines
987 B
Java
package speiger.src.coreengine.rendering.gui.components;
|
|
|
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
|
import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains;
|
|
|
|
public class LabelComponent extends GuiComponent
|
|
{
|
|
TextComponent text = new TextComponent();
|
|
int color;
|
|
|
|
public LabelComponent(String text, int color)
|
|
{
|
|
this(0F, 0F, 0F, 0F, text, color);
|
|
}
|
|
|
|
public LabelComponent(float x, float y, float width, float height, String text, int color)
|
|
{
|
|
super(x, y, width, height);
|
|
this.text.setText(text);
|
|
this.color = color;
|
|
}
|
|
|
|
public TextComponent getText()
|
|
{
|
|
return text;
|
|
}
|
|
|
|
public LabelComponent setColor(int color)
|
|
{
|
|
this.color = color;
|
|
return this;
|
|
}
|
|
|
|
public int getColor()
|
|
{
|
|
return color;
|
|
}
|
|
|
|
@Override
|
|
public void init()
|
|
{
|
|
addChild(text, Constrains.parent());
|
|
}
|
|
|
|
@Override
|
|
public boolean renderSelf(int mouseX, int mouseY, float particalTicks)
|
|
{
|
|
getRenderer().drawQuad(getBox(), color);
|
|
return true;
|
|
}
|
|
}
|