package speiger.src.coreengine.rendering.guiOld.components;

import speiger.src.coreengine.rendering.guiOld.GuiComponent;
import speiger.src.coreengine.rendering.guiOld.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(String text, int color, float textScale)
	{
		this(0F, 0F, 0F, 0F, text, color, textScale);
	}
	
	public LabelComponent(float x, float y, float width, float height, String text, int color)
	{
		this(x, y, width, height, text, color, 1F);
	}
	
	public LabelComponent(float x, float y, float width, float height, String text, int color, float textScale)
	{
		super(x, y, width, height);
		this.text.setText(text).setTextScale(textScale);
		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;
	}
}
