Search in sources :

Example 51 with PositionalLayout

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

the class GuiLocator method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setHorizontal().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(28, 10, 70, 10)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    toplevel.addChild(energyBar);
    initRedstoneMode();
    toplevel.addChild(redstoneMode);
    hostile = new ColorChoiceLabel(mc, this);
    hostileBeacon = new ToggleButton(mc, this);
    addBeaconSetting(toplevel, hostile, hostileBeacon, 30, "Hostile");
    hostile.setCurrentColor(tileEntity.getHostileType().getColor());
    hostileBeacon.setPressed(tileEntity.isHostileBeacon());
    passive = new ColorChoiceLabel(mc, this);
    passiveBeacon = new ToggleButton(mc, this);
    addBeaconSetting(toplevel, passive, passiveBeacon, 46, "Passive");
    passive.setCurrentColor(tileEntity.getPassiveType().getColor());
    passiveBeacon.setPressed(tileEntity.isPassiveBeacon());
    player = new ColorChoiceLabel(mc, this);
    playerBeacon = new ToggleButton(mc, this);
    addBeaconSetting(toplevel, player, playerBeacon, 62, "Player");
    player.setCurrentColor(tileEntity.getPlayerType().getColor());
    playerBeacon.setPressed(tileEntity.isPlayerBeacon());
    toplevel.addChild(new Label<>(mc, this).setText("Filter").setLayoutHint(new PositionalLayout.PositionalHint(8, 82, 40, 14)));
    filter = new TextField(mc, this);
    filter.setLayoutHint(new PositionalLayout.PositionalHint(50, 82, 90, 14));
    filter.setText(tileEntity.getFilter());
    filter.addTextEvent((parent, newText) -> update());
    toplevel.addChild(filter);
    energy = new ColorChoiceLabel(mc, this);
    energyBeacon = new ToggleButton(mc, this);
    addBeaconSetting(toplevel, energy, energyBeacon, 98, "Energy");
    energy.setCurrentColor(tileEntity.getEnergyType().getColor());
    energyBeacon.setPressed(tileEntity.isEnergyBeacon());
    toplevel.addChild(new Label<>(mc, this).setText("<").setLayoutHint(new PositionalLayout.PositionalHint(153, 98, 10, 14)));
    minEnergy = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(162, 98, 25, 14));
    minEnergy.setText(tileEntity.getMinEnergy() == null ? "" : Integer.toString(tileEntity.getMinEnergy()));
    minEnergy.addTextEvent((parent, newText) -> update());
    toplevel.addChild(new Label<>(mc, this).setText("%").setLayoutHint(new PositionalLayout.PositionalHint(187, 98, 10, 14)));
    toplevel.addChild(minEnergy);
    toplevel.addChild(new Label<>(mc, this).setText(">").setLayoutHint(new PositionalLayout.PositionalHint(205, 98, 10, 14)));
    maxEnergy = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(214, 98, 25, 14));
    maxEnergy.setText(tileEntity.getMaxEnergy() == null ? "" : Integer.toString(tileEntity.getMaxEnergy()));
    maxEnergy.addTextEvent((parent, newText) -> update());
    toplevel.addChild(maxEnergy);
    toplevel.addChild(new Label<>(mc, this).setText("%").setLayoutHint(new PositionalLayout.PositionalHint(238, 98, 10, 14)));
    toplevel.addChild(new Label<>(mc, this).setColor(0x993300).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText("RF per scan (every " + ScannerConfiguration.ticksPerLocatorScan + " ticks):").setLayoutHint(new PositionalLayout.PositionalHint(8, 186, 156, 14)));
    energyLabel = new Label(mc, this).setText("");
    energyLabel.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    energyLabel.setLayoutHint(new PositionalLayout.PositionalHint(8, 200, 156, 14));
    toplevel.addChild(energyLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
    energyConsumption = 0;
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 52 with PositionalLayout

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

the class GuiProjector method initGui.

@Override
public void initGui() {
    super.initGui();
    getShapeRenderer().initView(getPreviewLeft(), guiTop + 100);
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setHorizontal().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(6, 184, 75, 10)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    toplevel.addChild(energyBar);
    Label angleI = new Label(mc, this).setText("Angle");
    angleI.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    angleI.setLayoutHint(new PositionalLayout.PositionalHint(16, 30, 32, 15));
    angleLabel = new ScrollableLabel(mc, this).setRealMinimum(0).setRealMaximum(360).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(44, 30, 24, 15));
    angleLabel.setRealValue(tileEntity.getAngleInt());
    Button angleM = new Button(mc, this).setText("-").setLayoutHint(new PositionalLayout.PositionalHint(5, 30, 10, 15)).addButtonEvent(parent -> min(angleLabel));
    Button angleP = new Button(mc, this).setText("+").setLayoutHint(new PositionalLayout.PositionalHint(70, 30, 10, 15)).addButtonEvent(parent -> plus(angleLabel));
    angleSlider = new Slider(mc, this).setHorizontal().setScrollable(angleLabel).setLayoutHint(new PositionalLayout.PositionalHint(5, 46, 76, 15));
    toplevel.addChild(angleI).addChild(angleLabel).addChild(angleSlider).addChild(angleM).addChild(angleP);
    Label scaleI = new Label(mc, this).setText("Scale");
    scaleI.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    scaleI.setLayoutHint(new PositionalLayout.PositionalHint(16, 62, 32, 15));
    scaleLabel = new ScrollableLabel(mc, this).setRealMinimum(0).setRealMaximum(100).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(44, 62, 24, 15));
    scaleLabel.setRealValue(tileEntity.getScaleInt());
    Button scaleM = new Button(mc, this).setText("-").setLayoutHint(new PositionalLayout.PositionalHint(5, 62, 10, 15)).addButtonEvent(parent -> min(scaleLabel));
    Button scaleP = new Button(mc, this).setText("+").setLayoutHint(new PositionalLayout.PositionalHint(70, 62, 10, 15)).addButtonEvent(parent -> plus(scaleLabel));
    scaleSlider = new Slider(mc, this).setHorizontal().setScrollable(scaleLabel).setLayoutHint(new PositionalLayout.PositionalHint(5, 78, 76, 15));
    toplevel.addChild(scaleI).addChild(scaleLabel).addChild(scaleSlider).addChild(scaleM).addChild(scaleP);
    Label offsetI = new Label(mc, this).setText("Offset");
    offsetI.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    offsetI.setLayoutHint(new PositionalLayout.PositionalHint(16, 94, 32, 15));
    offsetLabel = new ScrollableLabel(mc, this).setRealMinimum(0).setRealMaximum(100).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(44, 94, 24, 15));
    offsetLabel.setRealValue(tileEntity.getOffsetInt());
    Button offsetM = new Button(mc, this).setText("-").setLayoutHint(new PositionalLayout.PositionalHint(5, 94, 10, 15)).addButtonEvent(parent -> min(offsetLabel));
    Button offsetP = new Button(mc, this).setText("+").setLayoutHint(new PositionalLayout.PositionalHint(70, 94, 10, 15)).addButtonEvent(parent -> plus(offsetLabel));
    offsetSlider = new Slider(mc, this).setHorizontal().setScrollable(offsetLabel).setLayoutHint(new PositionalLayout.PositionalHint(5, 110, 76, 15));
    toplevel.addChild(offsetI).addChild(offsetLabel).addChild(offsetSlider).addChild(offsetM).addChild(offsetP);
    autoRotate = new ToggleButton(mc, this).setCheckMarker(true).setText("Auto").setTooltips("Automatic client-side rotation").setLayoutHint(new PositionalLayout.PositionalHint(2, 128, 39, 16));
    autoRotate.setPressed(tileEntity.isAutoRotate());
    toplevel.addChild(autoRotate);
    scanline = new ToggleButton(mc, this).setCheckMarker(true).setText("SL").setTooltips("Enable/disable visual scanlines when", "the scan is refreshed").setLayoutHint(new PositionalLayout.PositionalHint(42, 128, 39, 16));
    scanline.setPressed(tileEntity.isScanline());
    toplevel.addChild(scanline);
    sound = new ToggleButton(mc, this).setCheckMarker(true).setText("Snd").setTooltips("Enable/disable sound during", "visual scan").setLayoutHint(new PositionalLayout.PositionalHint(2, 146, 39, 16));
    sound.setPressed(tileEntity.isSound());
    toplevel.addChild(sound);
    grayScale = new ToggleButton(mc, this).setCheckMarker(true).setText("Gray").setTooltips("Enable/disable grayscale", "mode").setLayoutHint(new PositionalLayout.PositionalHint(42, 146, 39, 16));
    grayScale.setPressed(tileEntity.isGrayscale());
    toplevel.addChild(grayScale);
    angleLabel.addValueEvent((parent, newValue) -> update());
    scaleLabel.addValueEvent((parent, newValue) -> update());
    offsetLabel.addValueEvent((parent, newValue) -> update());
    autoRotate.addButtonEvent(parent -> update());
    scanline.addButtonEvent(parent -> update());
    sound.addButtonEvent(parent -> update());
    grayScale.addButtonEvent(parent -> update());
    showAxis = ShapeGuiTools.createAxisButton(this, toplevel, 5, 200);
    showOuter = ShapeGuiTools.createBoxButton(this, toplevel, 31, 200);
    showScan = ShapeGuiTools.createScanButton(this, toplevel, 57, 200);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    initSidePanel();
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 53 with PositionalLayout

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

the class GuiShield method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(12, 141, 10, 76)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    initVisibilityMode();
    initActionOptions();
    initTypeOptions();
    initRedstoneMode();
    initDamageType();
    filterList = new WidgetList(mc, this).setDesiredHeight(120).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            selectFilter();
        }
    });
    Slider filterSlider = new Slider(mc, this).setVertical().setScrollable(filterList).setDesiredWidth(11).setDesiredHeight(120);
    Panel filterPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).setLayoutHint(new PositionalLayout.PositionalHint(12, 10, 154, 124)).addChild(filterList).addChild(filterSlider).setFilledBackground(0xff9e9e9e);
    Button applyCamo = new Button(mc, this).setText("Set").setTooltips("Set the camouflage block").setLayoutHint(new PositionalLayout.PositionalHint(51, 142, 28, 16)).addButtonEvent(parent -> applyCamoToShield());
    // applyCamo.setEnabled(false);
    // applyCamo.setTooltips("Not implemented yet");   // @todo
    colorSelector = new ColorChoiceLabel(mc, this).setTooltips("Color for the shield").setLayoutHint(new PositionalLayout.PositionalHint(31, 177, 48, 16));
    colorSelector.addColors(0x96ffc8);
    for (EnumDyeColor color : EnumDyeColor.values()) {
        colorSelector.addColors(color.getColorValue());
    }
    colorSelector.setCurrentColor(tileEntity.getShieldColor());
    colorSelector.addChoiceEvent((parent, newColor) -> sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_SETCOLOR, new Argument("color", newColor)));
    player = new TextField(mc, this).setTooltips("Optional player name").setLayoutHint(new PositionalLayout.PositionalHint(170, 44, 80, 14));
    addFilter = new Button(mc, this).setText("Add").setTooltips("Add selected filter").setLayoutHint(new PositionalLayout.PositionalHint(4, 6, 36, 14)).addButtonEvent(parent -> addNewFilter());
    delFilter = new Button(mc, this).setText("Del").setTooltips("Delete selected filter").setLayoutHint(new PositionalLayout.PositionalHint(39, 6, 36, 14)).addButtonEvent(parent -> removeSelectedFilter());
    upFilter = new Button(mc, this).setText("Up").setTooltips("Move filter up").setLayoutHint(new PositionalLayout.PositionalHint(4, 22, 36, 14)).addButtonEvent(parent -> moveFilterUp());
    downFilter = new Button(mc, this).setText("Down").setTooltips("Move filter down").setLayoutHint(new PositionalLayout.PositionalHint(39, 22, 36, 14)).addButtonEvent(parent -> moveFilterDown());
    Panel controlPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(170, 58, 80, 43)).addChild(addFilter).addChild(delFilter).addChild(upFilter).addChild(downFilter).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    Label lootingBonus = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setText("Looting:");
    lootingBonus.setTooltips("Insert dimensional shards", "for looting bonus").setLayoutHint(new PositionalLayout.PositionalHint(160, 118, 60, 18));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(visibilityOptions).addChild(applyCamo).addChild(redstoneMode).addChild(filterPanel).addChild(actionOptions).addChild(typeOptions).addChild(player).addChild(controlPanel).addChild(damageType).addChild(colorSelector).addChild(lootingBonus);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    listDirty = 0;
    requestFilters();
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Label(mcjty.lib.gui.widgets.Label) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) mcjty.rftools.blocks.shield.filters(mcjty.rftools.blocks.shield.filters) Panel(mcjty.lib.gui.widgets.Panel) Block(net.minecraft.block.Block) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) RFTools(mcjty.rftools.RFTools) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) RedstoneMode(mcjty.lib.varia.RedstoneMode) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) EnumDyeColor(net.minecraft.item.EnumDyeColor) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) Window(mcjty.lib.gui.Window) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) EnumDyeColor(net.minecraft.item.EnumDyeColor) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) TextField(mcjty.lib.gui.widgets.TextField) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 54 with PositionalLayout

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

the class GuiMatterBeamer method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) EnergyBar(mcjty.lib.gui.widgets.EnergyBar)

Example 55 with PositionalLayout

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

the class GuiSpawner method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    blocks[0] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(80, 5, 18, 18));
    blocks[1] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(80, 25, 18, 18));
    blocks[2] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(80, 45, 18, 18));
    labels[0] = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    labels[0].setLayoutHint(new PositionalLayout.PositionalHint(100, 5, 74, 18));
    labels[1] = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    labels[1].setLayoutHint(new PositionalLayout.PositionalHint(100, 25, 74, 18));
    labels[2] = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    labels[2].setLayoutHint(new PositionalLayout.PositionalHint(100, 45, 74, 18));
    name = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    name.setLayoutHint(new PositionalLayout.PositionalHint(22, 31, 78, 16));
    rfTick = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    rfTick.setLayoutHint(new PositionalLayout.PositionalHint(22, 47, 78, 16));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(blocks[0]).addChild(labels[0]).addChild(blocks[1]).addChild(labels[1]).addChild(blocks[2]).addChild(labels[2]).addChild(rfTick).addChild(name);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label)

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 Button (mcjty.lib.gui.widgets.Button)16 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)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 Slot (net.minecraft.inventory.Slot)10 List (java.util.List)9