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

import speiger.src.coreengine.math.misc.ColorObject;
import speiger.src.coreengine.rendering.gui.GuiComponent;
import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints;

public class LabelComponent extends GuiComponent
{
	TextComponent text = new TextComponent();
	ColorObject color;
	
	public LabelComponent(String text, ColorObject color)
	{
		this(0F, 0F, 0F, 0F, text, color);
	}
	
	public LabelComponent(float x, float y, float width, float height, String text, ColorObject color)
	{
		super(x, y, width, height);
		this.text.setText(text);
		this.color = color;
	}
	
	public TextComponent getText()
	{
		return text;
	}
	
	public LabelComponent setColor(ColorObject color)
	{
		this.color = color;
		return this;
	}
	
	public ColorObject getColor()
	{
		return color;
	}
	
	@Override
	public void init()
	{
		addChild(text, Constraints.getParentConstrains());
	}
	
	@Override
	public boolean renderSelf(int mouseX, int mouseY, float particalTicks)
	{
		getRenderer().drawQuad(getBox(), color);
		return true;
	}
}
