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

import speiger.src.coreengine.rendering.guiOld.GuiComponent;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;

public class IconComponent extends GuiComponent
{
	ITexture texture;
	int override = -1;
	
	public IconComponent(ITexture texture)
	{
		super(0F, 0F, 0F, 0F);
		this.texture = texture;
	}
	
	public IconComponent(ITexture texture, int color)
	{
		super(0F, 0F, 0F, 0F);
		this.texture = texture;
		override = color;
	}
	
	public IconComponent(float x, float y, float width, float height, ITexture texture)
	{
		super(x, y, width, height);
		this.texture = texture;
	}
	
	public IconComponent(float x, float y, float width, float height, ITexture texture, int color)
	{
		super(x, y, width, height);
		this.texture = texture;
		override = color;
	}
	
	public IconComponent setTexture(ITexture texture)
	{
		this.texture = texture;
		return this;
	}
	
	public IconComponent setColor(int color)
	{
		override = color;
		return this;
	}

	@Override
	public void init()
	{
	}
	
	@Override
	protected boolean renderSelf(int mouseX, int mouseY, float particalTicks)
	{
		getRenderer().setActiveTexture(texture).drawTexturedQuad(getBox(), override, texture.getUMin(), texture.getVMin(), texture.getUMax(), texture.getVMax());
		return true;
	}
}