use of buildcraft.lib.gui.pos.GuiRectangle in project BuildCraft by BuildCraft.
the class GuiEngineIron_BC8 method initGui.
@Override
public void initGui() {
super.initGui();
mainGui.shownElements.add(container.widgetTankFuel.createGuiElement(mainGui, new GuiRectangle(26, 18, 16, 60).offset(mainGui.rootElement), ICON_TANK_OVERLAY));
mainGui.shownElements.add(container.widgetTankCoolant.createGuiElement(mainGui, new GuiRectangle(80, 18, 16, 60).offset(mainGui.rootElement), ICON_TANK_OVERLAY));
mainGui.shownElements.add(container.widgetTankResidue.createGuiElement(mainGui, new GuiRectangle(134, 18, 16, 60).offset(mainGui.rootElement), ICON_TANK_OVERLAY));
}
use of buildcraft.lib.gui.pos.GuiRectangle in project BuildCraft by BuildCraft.
the class GuideChapter method isMouseInside.
protected boolean isMouseInside() {
IFontRenderer font = gui.getCurrentFont();
String text = chapter.text;
int width = (int) (font.getStringWidth(text) + getHoverWidth(0));
int y = gui.minY + 20 * (gui.getChapterIndex(this) + 1);
if (lastDrawn == EnumGuiSide.LEFT) {
int x = gui.minX - width - 4 + 11;
GuiRectangle drawRect = new GuiRectangle(x, y - 4, width + GuiGuide.CHAPTER_MARKER_LEFT.width, 16);
if (drawRect.contains(gui.mouse)) {
return true;
}
} else if (lastDrawn == EnumGuiSide.RIGHT) {
int x = gui.minX + GuiGuide.PAGE_LEFT.width + GuiGuide.PAGE_RIGHT.width - 11;
GuiRectangle drawRect = new GuiRectangle(x, y - 4, width + GuiGuide.CHAPTER_MARKER_RIGHT.width, 16);
if (drawRect.contains(gui.mouse)) {
return true;
}
}
return false;
}
use of buildcraft.lib.gui.pos.GuiRectangle in project BuildCraft by BuildCraft.
the class GuidePageBase method handleMouseClick.
public void handleMouseClick(int x, int y, int width, int height, int mouseX, int mouseY, int mouseButton, int index, boolean isEditing) {
// Even => first page, test page back button and first page text clicks
if (index % 2 == 0) {
if (index != 0) {
GuiIcon icon = GuiGuide.TURN_BACK;
GuiRectangle turnBox = new GuiRectangle(x, y + height, icon.width, icon.height);
if (turnBox.contains(gui.mouse)) {
lastPage();
}
}
} else {
// Odd => second page, test forward page button
if (index + 1 < numPages) {
GuiIcon icon = GuiGuide.TURN_FORWARDS;
GuiRectangle turnBox = new GuiRectangle(x + width - icon.width, y + height, icon.width, icon.height);
if (turnBox.contains(gui.mouse)) {
nextPage();
}
}
}
}
use of buildcraft.lib.gui.pos.GuiRectangle in project BuildCraft by BuildCraft.
the class GuideAssembly method handleMouseClick.
@Override
public PagePosition handleMouseClick(int x, int y, int width, int height, PagePosition current, int index, int mouseX, int mouseY) {
if (current.pixel + PIXEL_HEIGHT > height) {
current = current.newPage();
}
x += OFFSET.x;
y += OFFSET.y + current.pixel;
if (current.page == index) {
for (int i = 0; i < input.length; i++) {
GuiRectangle rect = ITEM_POSITION[i];
ItemStack stack = input[i].get();
testClickItemStack(stack, x + (int) rect.x, y + (int) rect.y);
}
testClickItemStack(output.get(), x + (int) OUT_POSITION.x, y + (int) OUT_POSITION.y);
}
current = current.nextLine(PIXEL_HEIGHT, height);
return current;
}
use of buildcraft.lib.gui.pos.GuiRectangle in project BuildCraft by BuildCraft.
the class GuiEmzuliPipe_BC8 method addButton.
private void addButton(SlotIndex index, int x, int y) {
Supplier<EnumDyeColor> getter = () -> container.behaviour.slotColours.get(index);
Consumer<EnumDyeColor> setter = c -> container.paintWidgets.get(index).setColour(c);
IGuiPosition elem = mainGui.rootElement.offset(x, y);
GuiButtonDrawable button = new GuiButtonDrawable(mainGui, index.name(), elem, PAINT_BUTTON_BUILDER);
button.registerListener((b, key) -> {
final EnumDyeColor old = getter.get();
EnumDyeColor nColour;
switch(key) {
case 0:
{
nColour = ColourUtil.getNextOrNull(old);
break;
}
case 1:
{
nColour = ColourUtil.getPrevOrNull(old);
break;
}
case 2:
{
nColour = null;
break;
}
default:
{
return;
}
}
setter.accept(nColour);
});
mainGui.shownElements.add(button);
// Button paintbrush
IGuiArea area = new GuiRectangle(20, 20).offset(elem);
ISimpleDrawable paintIcon = (px, py) -> {
EnumDyeColor colour = getter.get();
if (colour == null) {
ICON_NO_PAINT.drawAt(px + 2, py + 2);
} else {
ISprite sprite = BCTransportSprites.ACTION_PIPE_COLOUR[colour.ordinal()];
GuiIcon.drawAt(sprite, px + 2, py + 2, 16);
}
};
mainGui.shownElements.add(new GuiElementDrawable(mainGui, area, paintIcon, false));
ITooltipElement tooltips = list -> {
EnumDyeColor colour = getter.get();
String line;
if (colour == null) {
line = LocaleUtil.localize("gui.pipes.emzuli.nopaint");
} else {
line = LocaleUtil.localize("gui.pipes.emzuli.paint", ColourUtil.getTextFullTooltip(colour));
}
list.add(new ToolTip(line));
};
mainGui.shownElements.add(new GuiElementToolTip(mainGui, area, tooltips));
}
Aggregations