56 lines
1.6 KiB
Java
56 lines
1.6 KiB
Java
package speiger.src.coreengine.rendering.gui.components;
|
|
|
|
import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains;
|
|
import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain;
|
|
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
|
import speiger.src.coreengine.rendering.gui.helper.constrains.TextConstrain;
|
|
|
|
public class TextCheckBoxComponent extends CheckBoxComponent
|
|
{
|
|
TextComponent text = new TextComponent().singleLine(true).limit(false).setTextScale(0.35F);
|
|
|
|
public TextCheckBoxComponent(int color, String text)
|
|
{
|
|
super(color);
|
|
this.text.setText(text);
|
|
}
|
|
|
|
public TextCheckBoxComponent(int color, String text, boolean checked)
|
|
{
|
|
super(color, checked);
|
|
this.text.setText(text);
|
|
}
|
|
|
|
public TextCheckBoxComponent(float x, float y, float width, float height, int color, String text)
|
|
{
|
|
super(x, y, width, height, color);
|
|
this.text.setText(text);
|
|
}
|
|
|
|
public TextCheckBoxComponent(float x, float y, float width, float height, int color, String text, boolean checked)
|
|
{
|
|
super(x, y, width, height, color, checked);
|
|
this.text.setText(text);
|
|
}
|
|
|
|
@Override
|
|
public void init()
|
|
{
|
|
super.init();
|
|
addChild(text, new Constrains(new PixelConstrain(getBox().getWidth() + 1F), new ParentConstrain(), TextConstrain.width(text), new ParentConstrain()));
|
|
}
|
|
|
|
public TextComponent getText()
|
|
{
|
|
return text;
|
|
}
|
|
|
|
@Override
|
|
public boolean renderSelf(int mouseX, int mouseY, float particalTicks)
|
|
{
|
|
super.renderSelf(mouseX, mouseY, particalTicks);
|
|
text.setBrightness(getBrightness(mouseX, mouseY));
|
|
return true;
|
|
}
|
|
}
|