Search in sources :

Example 21 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.

the class GuiScreen method initGui.

@Override
public void initGui() {
    super.initGui();
    toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    for (int i = 0; i < ScreenContainer.SCREEN_MODULES; i++) {
        buttons[i] = new ToggleButton(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(30, 7 + i * 18 + 1, 40, 16)).setEnabled(false).setTooltips("Open the gui for this", "module");
        final int finalI = i;
        buttons[i].addButtonEvent(parent -> selectPanel(finalI));
        toplevel.addChild(buttons[i]);
        modulePanels[i] = null;
        clientScreenModules[i] = null;
    }
    bright = new ToggleButton(mc, this).setText("Bright").setCheckMarker(true).setTooltips("Toggle full brightness").setLayoutHint(new PositionalLayout.PositionalHint(85, 123, 55, 14));
    // .setLayoutHint(new PositionalLayout.PositionalHint(7, 208, 63, 14));
    bright.setPressed(tileEntity.isBright());
    bright.addButtonEvent(parent -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenTileEntity.CMD_SETBRIGHT, new Argument("b", bright.isPressed())));
    toplevel.addChild(bright);
    toplevel.addChild(new Label(mc, this).setText("Font:").setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(85 + 50 + 9, 123, 30, 14)));
    trueType = new ChoiceLabel(mc, this).addChoices("Default", "Truetype", "Vanilla").setTooltips("Set truetype font mode", "for the screen").setLayoutHint(new PositionalLayout.PositionalHint(85 + 50 + 14 + 30, 123, 68, 14));
    int trueTypeMode = tileEntity.getTrueTypeMode();
    trueType.setChoice(trueTypeMode == 0 ? "Default" : (trueTypeMode == -1 ? "Vanilla" : "Truetype"));
    trueType.addChoiceEvent((a, b) -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenTileEntity.CMD_SETTRUETYPE, new Argument("b", getCurrentTruetypeChoice())));
    toplevel.addChild(trueType);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    selected = -1;
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Argument(mcjty.lib.network.Argument) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel)

Example 22 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.

the class GuiRelay method createRedstonePanel.

private Panel createRedstonePanel() {
    ImageLabel redstoneOff = new ImageLabel(mc, this).setImage(iconGuiElements, 16, 0);
    redstoneOff.setDesiredWidth(16).setDesiredHeight(16).setTooltips("Redstone signal off").setLayoutHint(new PositionalLayout.PositionalHint(70, 0, 16, 16));
    ImageLabel redstoneOn = new ImageLabel(mc, this).setImage(iconGuiElements, 32, 0);
    redstoneOn.setDesiredWidth(16).setDesiredHeight(16).setTooltips("Redstone signal on").setLayoutHint(new PositionalLayout.PositionalHint(190, 0, 16, 16));
    return new Panel(mc, this).setLayout(new PositionalLayout()).addChild(redstoneOff).addChild(redstoneOn);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Example 23 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.

the class GuiThreeLogic method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    for (int i = 0; i < 8; i++) {
        final int finalI = i;
        ChoiceLabel tl = new ChoiceLabel(mc, this).addChoices("On", "Off", "Keep").setDesiredWidth(38).setDesiredHeight(14).setLayoutHint(new PositionalLayout.PositionalHint(146, 25 + i * 15));
        tl.setChoiceTooltip("On", "Emit redstone signal");
        tl.setChoiceTooltip("Off", "Don't emit redstone signal");
        tl.setChoiceTooltip("Keep", "Keep previous redstone signal");
        int state = tileEntity.getState(i);
        switch(state) {
            case 0:
                tl.setChoice("Off");
                break;
            case 1:
                tl.setChoice("On");
                break;
            default:
                tl.setChoice("Keep");
                break;
        }
        tl.addChoiceEvent((widget, s) -> {
            String current = tl.getCurrentChoice();
            int st = "On".equals(current) ? 1 : "Off".equals(current) ? 0 : -1;
            sendServerCommand(RFToolsMessages.INSTANCE, ThreeLogicTileEntity.CMD_SETSTATE, new Argument("index", finalI), new Argument("state", st));
        });
        outputs.add(tl);
        toplevel.addChild(tl);
    }
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, LOGIC3_WIDTH, LOGIC3_HEIGHT));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Example 24 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.

the class GuiComposer method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    getShapeRenderer().initView(getPreviewLeft(), guiTop + 100);
    ShapeModifier[] modifiers = tileEntity.getModifiers();
    operationLabels[0] = null;
    for (int i = 0; i < ComposerContainer.SLOT_COUNT; i++) {
        operationLabels[i] = new ChoiceLabel(mc, this).addChoices(ShapeOperation.UNION.getCode(), ShapeOperation.SUBTRACT.getCode(), ShapeOperation.INTERSECT.getCode());
        for (ShapeOperation operation : ShapeOperation.values()) {
            operationLabels[i].setChoiceTooltip(operation.getCode(), operation.getDescription());
        }
        operationLabels[i].setLayoutHint(new PositionalLayout.PositionalHint(55, 7 + i * 18, 26, 16));
        operationLabels[i].setChoice(modifiers[i].getOperation().getCode());
        operationLabels[i].addChoiceEvent((parent, newChoice) -> update());
        toplevel.addChild(operationLabels[i]);
    }
    operationLabels[0].setEnabled(false);
    for (int i = 0; i < ComposerContainer.SLOT_COUNT; i++) {
        configButton[i] = new Button(mc, this).setText("?");
        configButton[i].setLayoutHint(new PositionalLayout.PositionalHint(3, 7 + i * 18 + 2, 13, 12));
        int finalI = i;
        configButton[i].addButtonEvent(parent -> openCardGui(finalI));
        configButton[i].setTooltips("Click to open the card gui");
        toplevel.addChild(configButton[i]);
    }
    outConfigButton = new Button(mc, this).setText("?");
    outConfigButton.setLayoutHint(new PositionalLayout.PositionalHint(3, 200 + 2, 13, 12));
    outConfigButton.addButtonEvent(parent -> openCardGui(-1));
    outConfigButton.setTooltips("Click to open the card gui");
    toplevel.addChild(outConfigButton);
    showAxis = ShapeGuiTools.createAxisButton(this, toplevel, 5, 176);
    showOuter = ShapeGuiTools.createBoxButton(this, toplevel, 31, 176);
    showScan = ShapeGuiTools.createScanButton(this, toplevel, 57, 176);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    Panel sidePanel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(sideBackground);
    String[] tt = { "Drag left mouse button to rotate", "Shift drag left mouse to pan", "Use mouse wheel to zoom in/out", "Use middle click to reset rotation" };
    sidePanel.addChild(new Label<>(mc, this).setText("E").setColor(0xffff0000).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(5, 175, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("W").setColor(0xffff0000).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(40, 175, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("U").setColor(0xff00bb00).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(5, 190, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("D").setColor(0xff00bb00).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(40, 190, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("N").setColor(0xff0000ff).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(5, 205, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("S").setColor(0xff0000ff).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(40, 205, 15, 15)));
    for (int i = 0; i < ComposerContainer.SLOT_COUNT; i++) {
        ToggleButton flip = new ToggleButton(mc, this).setText("Flip").setCheckMarker(true).setLayoutHint(new PositionalLayout.PositionalHint(6, 7 + i * 18, 35, 16));
        flip.setPressed(modifiers[i].isFlipY());
        flip.addButtonEvent(parent -> update());
        sidePanel.addChild(flip);
        flipButtons[i] = flip;
        ChoiceLabel rot = new ChoiceLabel(mc, this).addChoices("None", "X", "Y", "Z").setChoice("None").setLayoutHint(new PositionalLayout.PositionalHint(45, 7 + i * 18, 35, 16));
        rot.setChoice(modifiers[i].getRotation().getCode());
        rot.addChoiceEvent((parent, newChoice) -> update());
        sidePanel.addChild(rot);
        rotationLabels[i] = rot;
    }
    sidePanel.setBounds(new Rectangle(guiLeft - SIDEWIDTH, guiTop, SIDEWIDTH, ySize));
    sideWindow = new Window(this, sidePanel);
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 25 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.

the class GuiProjector method initSidePanel.

private void initSidePanel() {
    Panel sidePanel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(sideBackground);
    initRsPanel(sidePanel, 0, "S");
    initRsPanel(sidePanel, 1, "N");
    initRsPanel(sidePanel, 2, "E");
    initRsPanel(sidePanel, 3, "W");
    sidePanel.setBounds(new Rectangle(guiLeft - SIDEWIDTH, guiTop, SIDEWIDTH, ySize));
    sideWindow = new Window(this, sidePanel);
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Aggregations

PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)62 Window (mcjty.lib.gui.Window)53 Panel (mcjty.lib.gui.widgets.Panel)47 Label (mcjty.lib.gui.widgets.Label)25 Argument (mcjty.lib.network.Argument)19 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)18 ResourceLocation (net.minecraft.util.ResourceLocation)18 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)16 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)15 Button (mcjty.lib.gui.widgets.Button)15 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)15 ItemStack (net.minecraft.item.ItemStack)15 Rectangle (java.awt.Rectangle)14 StyleConfig (mcjty.lib.base.StyleConfig)14 RFTools (mcjty.rftools.RFTools)14 java.awt (java.awt)13 TextField (mcjty.lib.gui.widgets.TextField)13 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)11 List (java.util.List)9 Slot (net.minecraft.inventory.Slot)9