use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.
the class GuidePageBase method renderPage.
protected void renderPage(int x, int y, int width, int height, int index) {
// Even => first page, draw page back button and first page index
if (index % 2 == 0) {
// Back page button
if (index != 0) {
GuiIcon icon = GuiGuide.TURN_BACK;
GuiRectangle turnBox = new GuiRectangle(x, y + height, icon.width, icon.height);
if (turnBox.contains(gui.mouse)) {
icon = GuiGuide.TURN_BACK_HOVERED;
}
icon.drawAt(turnBox);
}
// Page index
String text = (index + 1) + " / " + numPages;
double textX = x + GuiGuide.PAGE_LEFT_TEXT.width / 2 - getFontRenderer().getStringWidth(text) / 2;
getFontRenderer().drawString(text, (int) textX, (int) (y + height) + 6, 0);
} else {
// Back 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)) {
icon = GuiGuide.TURN_FORWARDS_HOVERED;
}
icon.drawAt(turnBox);
}
// Page index
if (index + 1 <= numPages) {
String text = (index + 1) + " / " + numPages;
double textX = x + (GuiGuide.PAGE_RIGHT_TEXT.width - getFontRenderer().getStringWidth(text)) / 2;
getFontRenderer().drawString(text, (int) textX, (int) (y + height) + 6, 0);
}
}
}
use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.
the class GuiElementStatementDrag method drawForeground.
@Override
public void drawForeground(float partialTicks) {
if (isDragging) {
boolean canPlace = false;
for (IGuiElement element : gui.getElementsAt(gui.mouse.getX(), gui.mouse.getY())) {
if (element instanceof IReference<?>) {
if (checkCanSet((IReference<?>) element, dragging)) {
canPlace = true;
break;
}
}
}
GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT);
if (!canPlace) {
GlStateManager.color(1.0f, 0.7f, 0.7f);
}
double x = gui.mouse.getX() - 9;
double y = gui.mouse.getY() - 9;
if (dragging instanceof IStatementParameter) {
ParameterRenderer.draw((IStatementParameter) dragging, x, y);
} else {
GuiIcon background = GuiElementStatement.SLOT_COLOUR;
if (dragging instanceof StatementWrapper) {
EnumPipePart part = ((StatementWrapper) dragging).sourcePart;
if (part != EnumPipePart.CENTER) {
background = background.offset(0, (1 + part.getIndex()) * 18);
}
}
background.drawAt(x, y);
if (dragging != null) {
ISprite sprite = dragging.getSprite();
if (sprite != null) {
GuiIcon.drawAt(sprite, x + 1, y + 1, 16);
}
}
}
GlStateManager.color(1, 1, 1);
}
}
use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.
the class GuiElementStatementSource method drawGuiSlot.
public static void drawGuiSlot(@Nullable IGuiSlot guiSlot, double x, double y) {
if (guiSlot instanceof IStatementParameter) {
ParameterRenderer.draw((IStatementParameter) guiSlot, x, y);
return;
}
GuiIcon background = GuiElementStatement.SLOT_COLOUR;
if (guiSlot instanceof StatementWrapper) {
EnumPipePart part = ((StatementWrapper) guiSlot).sourcePart;
if (part != EnumPipePart.CENTER) {
background = background.offset(0, (1 + part.getIndex()) * 18);
}
}
background.drawAt(x, y);
if (guiSlot != null) {
ISprite sprite = guiSlot.getSprite();
if (sprite != null) {
GuiIcon.drawAt(sprite, x + 1, y + 1, 16);
}
}
}
use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.
the class GuiDiamondWoodPipe method drawForegroundLayer.
@Override
protected void drawForegroundLayer() {
String title = LocaleUtil.localize("gui.pipes.emerald.title");
double titleX = mainGui.rootElement.getX() + (xSize - fontRenderer.getStringWidth(title)) / 2;
fontRenderer.drawString(title, (int) titleX, (int) mainGui.rootElement.getY() + 6, 0x404040);
fontRenderer.drawString(LocaleUtil.localize("gui.inventory"), (int) mainGui.rootElement.getX() + 8, (int) mainGui.rootElement.getY() + ySize - 93, 0x404040);
if (pipe.filterMode == FilterMode.ROUND_ROBIN) {
GlStateManager.color(1, 1, 1, 1);
GuiIcon icon = pipe.filterValid ? ICON_ROUND_ROBIN_INDEX : ICON_ROUND_ROBIN_NONE;
int x = pipe.filterValid ? 18 * pipe.currentFilter : 0;
icon.drawAt(mainGui.rootElement.getX() + 6 + x, mainGui.rootElement.getY() + 16);
}
}
use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.
the class GuiAutoCraftItems method drawBackgroundLayer.
@Override
protected void drawBackgroundLayer(float partialTicks) {
ICON_GUI.drawAt(mainGui.rootElement);
double progress = container.tile.getProgress(partialTicks);
drawProgress(RECT_PROGRESS, ICON_PROGRESS, progress, 1);
if (hasFilters()) {
RenderHelper.enableGUIStandardItemLighting();
forEachFilter((slot, filterStack) -> {
int x = slot.xPos + (int) mainGui.rootElement.getX();
int y = slot.yPos + (int) mainGui.rootElement.getY();
itemRender.renderItemAndEffectIntoGUI(mc.player, filterStack, x, y);
itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, filterStack, x, y, null);
});
RenderHelper.disableStandardItemLighting();
GlStateManager.disableDepth();
forEachFilter((slot, filterStack) -> {
ItemStack real = slot.getStack();
final GuiIcon icon;
if (real.isEmpty() || StackUtil.canMerge(real, filterStack)) {
icon = ICON_FILTER_OVERLAY_SAME;
} else {
icon = ICON_FILTER_OVERLAY_DIFFERENT;
}
int x = slot.xPos + (int) mainGui.rootElement.getX();
int y = slot.yPos + (int) mainGui.rootElement.getY();
icon.drawAt(x - 1, y - 1);
});
GlStateManager.enableDepth();
}
}
Aggregations