Search in sources :

Example 6 with Bounds

use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.

the class TableCellPresetAction 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() - DIRECTION_BUTTON_WIDTH * 2;
    boolean canChange = actions.size() > 1 || (actions.size() == 1 && !Objects.equals(getPropertyValue(), actions.get(0).actionID));
    leftButton = new GuiButton(-1, bounds.getMinX(), buttonY, DIRECTION_BUTTON_WIDTH - 1, 20, TableCellEnum.LEFT_ARROW);
    leftButton.visible = !isHidden();
    leftButton.enabled = canChange;
    screen.addButton(this, 0, leftButton);
    rightButton = new GuiButton(-1, bounds.getMinX() + DIRECTION_BUTTON_WIDTH + presetButtonWidth + 1, buttonY, DIRECTION_BUTTON_WIDTH - 1, 20, TableCellEnum.RIGHT_ARROW);
    rightButton.visible = !isHidden();
    rightButton.enabled = canChange;
    screen.addButton(this, 1, rightButton);
    for (TableCellButton action : actions) action.initGui(screen);
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) Bounds(ivorius.reccomplex.gui.table.Bounds)

Example 7 with Bounds

use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.

the class TableCellTitle method draw.

@Override
public void draw(GuiTable screen, int mouseX, int mouseY, float partialTicks) {
    super.draw(screen, mouseX, mouseY, partialTicks);
    Bounds bounds = bounds();
    FontRenderer fontRenderer = getFontRenderer();
    screen.drawCenteredString(fontRenderer, displayString, bounds.getCenterX(), positioning.getY(fontRenderer, bounds.getMinY(), bounds.getMaxY()), 0xffffffff);
}
Also used : Bounds(ivorius.reccomplex.gui.table.Bounds) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 8 with Bounds

use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.

the class TitledCell method drawFloating.

@Override
public void drawFloating(GuiTable screen, int mouseX, int mouseY, float partialTicks) {
    super.drawFloating(screen, mouseX, mouseY, partialTicks);
    cell.drawFloating(screen, mouseX, mouseY, partialTicks);
    Bounds bounds = bounds();
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    String title = getTitle();
    if (title != null) {
        int stringWidth = Math.max(fontRenderer.getStringWidth(title), 100);
        List<String> tooltip = getTitleTooltip();
        if (tooltip != null)
            screen.drawTooltipRect(tooltip, Bounds.fromSize(bounds.getMinX() + TITLE_WIDTH - stringWidth - 10, bounds.getCenterY() - 6, stringWidth, 12), mouseX, mouseY, fontRenderer);
    }
}
Also used : Bounds(ivorius.reccomplex.gui.table.Bounds) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 9 with Bounds

use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.

the class TableCellButton method initGui.

@Override
public void initGui(GuiTable screen) {
    super.initGui(screen);
    Bounds bounds = bounds();
    button = new GuiTexturedButton(-1, bounds.getMinX(), bounds.getMinY() + (bounds.getHeight() - 20) / 2, bounds.getWidth(), 20, title);
    button.setTexture(texture);
    button.visible = !isHidden();
    button.enabled = enabled;
    screen.addButton(this, 0, button);
}
Also used : Bounds(ivorius.reccomplex.gui.table.Bounds) GuiTexturedButton(ivorius.reccomplex.gui.GuiTexturedButton)

Example 10 with Bounds

use of ivorius.reccomplex.gui.table.Bounds in project RecurrentComplex by Ivorforce.

the class TableCellFloat 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.format(titleFormat, property));
        slider.addListener(this);
    }
    updateSliderBounds(bounds);
    slider.setMinValue(scale.out(min));
    slider.setMaxValue(scale.out(max));
    slider.enabled = enabled;
    slider.setValue(scale.out(property));
    slider.visible = !isHidden();
    screen.addButton(this, 0, slider);
}
Also used : Bounds(ivorius.reccomplex.gui.table.Bounds) GuiSlider(ivorius.ivtoolkit.gui.GuiSlider)

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