Search in sources :

Example 1 with Bounds

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;
    }
}
Also used : Bounds(ivorius.reccomplex.gui.table.Bounds) GuiTextField(net.minecraft.client.gui.GuiTextField) GuiValidityStateIndicator(ivorius.reccomplex.gui.GuiValidityStateIndicator)

Example 2 with Bounds

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);
}
Also used : Bounds(ivorius.reccomplex.gui.table.Bounds) GuiSlider(ivorius.ivtoolkit.gui.GuiSlider)

Example 3 with Bounds

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);
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) Bounds(ivorius.reccomplex.gui.table.Bounds)

Example 4 with Bounds

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);
}
Also used : Bounds(ivorius.reccomplex.gui.table.Bounds) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 5 with Bounds

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);
}
Also used : Bounds(ivorius.reccomplex.gui.table.Bounds) GuiSliderRange(ivorius.ivtoolkit.gui.GuiSliderRange)

Aggregations

Bounds (ivorius.reccomplex.gui.table.Bounds)15 FontRenderer (net.minecraft.client.gui.FontRenderer)4 GuiButton (net.minecraft.client.gui.GuiButton)4 GuiSlider (ivorius.ivtoolkit.gui.GuiSlider)3 GuiSliderRange (ivorius.ivtoolkit.gui.GuiSliderRange)1 GuiTexturedButton (ivorius.reccomplex.gui.GuiTexturedButton)1 GuiValidityStateIndicator (ivorius.reccomplex.gui.GuiValidityStateIndicator)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1