use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.
the class TableCellTextField method initGui.
@Override
public void initGui(GuiTable screen) {
super.initGui(screen);
Bounds bounds = bounds();
if (textField == null)
textField = new GuiTextField(0, getFontRenderer(), 0, 0, 0, 0);
updateTextFieldBounds(bounds);
textField.setMaxStringLength(maxStringLength);
textField.setText(serialize(getPropertyValue()));
textField.setVisible(!isHidden());
textField.setEnabled(enabled);
if (showsValidityState()) {
stateIndicator = new GuiValidityStateIndicator(bounds.getMaxX() - 12, bounds.getCenterY() - 5, GuiValidityStateIndicator.State.UNKNWON);
updateValidityStateIndicator();
stateIndicator.setVisible(!isHidden());
} else {
stateIndicator = null;
}
}
use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.
the class TableCellInteger method initGui.
@Override
public void initGui(GuiTable screen) {
super.initGui(screen);
Bounds bounds = bounds();
if (slider == null) {
slider = new GuiSlider(-1, 0, 0, 0, 0, String.valueOf(property));
slider.addListener(this);
}
updateSliderBounds(bounds);
slider.setMinValue(min);
slider.setMaxValue(max);
slider.enabled = enabled;
slider.setValue(property);
slider.visible = !isHidden();
screen.addButton(this, 0, slider);
}
use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.
the class TableCellEnum method initGui.
@Override
public void initGui(GuiTable screen) {
super.initGui(screen);
Bounds bounds = bounds();
int buttonY = bounds.getMinY() + (bounds.getHeight() - 20) / 2;
int presetButtonWidth = bounds.getWidth() - TableCellPresetAction.DIRECTION_BUTTON_WIDTH * 2;
boolean canChange = (options.size() > 1 || (options.size() == 1 && !Objects.equals(getPropertyValue(), options.get(0).value))) && enabled;
leftButton = new GuiButton(-1, bounds.getMinX(), buttonY, TableCellPresetAction.DIRECTION_BUTTON_WIDTH - 1, 20, LEFT_ARROW);
leftButton.visible = !isHidden();
leftButton.enabled = canChange;
screen.addButton(this, 0, leftButton);
rightButton = new GuiButton(-1, bounds.getMinX() + TableCellPresetAction.DIRECTION_BUTTON_WIDTH + presetButtonWidth + 1, buttonY, TableCellPresetAction.DIRECTION_BUTTON_WIDTH - 1, 20, RIGHT_ARROW);
rightButton.visible = !isHidden();
rightButton.enabled = canChange;
screen.addButton(this, 1, rightButton);
}
use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.
the class TableCellEnum method draw.
@Override
public void draw(GuiTable screen, int mouseX, int mouseY, float partialTicks) {
FontRenderer fontRenderer = getFontRenderer();
Bounds bounds = bounds();
Option<T> cOption = currentOption();
String option = cOption != null ? cOption.title : getPropertyValue().toString();
int width = fontRenderer.getStringWidth(option);
fontRenderer.drawString(option, bounds.getCenterX() - width / 2, bounds.getCenterY() - 4, 0xffffffff, true);
super.draw(screen, mouseX, mouseY, partialTicks);
}
use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.
the class TableCellFloatRange method initGui.
@Override
public void initGui(GuiTable screen) {
super.initGui(screen);
Bounds bounds = bounds();
if (slider == null) {
slider = new GuiSliderRange(-1, 0, 0, 0, 0, getRangeString());
slider.addListener(this);
}
updateSliderBounds(bounds);
slider.setMinValue(scale.out(min));
slider.setMaxValue(scale.out(max));
slider.enabled = enabled;
slider.setRange(Scales.out(scale, property));
slider.visible = !isHidden();
screen.addButton(this, 0, slider);
}
Aggregations