@Override public void render() { super.render(); if (step.shouldShowStack()) { Point pos = getPosOnScreen(); DrawingTools.drawString(step.getDescription(), 5, display.getWidth(), Colors.WHITE, getWidth() - 5); int x = (getWidth() - display.getWidth()) / 2; display.draw(getGuiScreen(), x, 0); if(isFocused()) display.drawTooltip(getGuiScreen(), x, 0, getLastMouseX(), getLastMouseY(), pos.getX(), pos.getY()); } else DrawingTools.drawString(step.getDescription(), 5, 0, Colors.WHITE, getWidth() - 5); }
@Override public GuiElement getTooltip(RenderInfo renderInfo) { if (tooltip != null && lastSize != null) { Point mouse = new Point(renderInfo.mouseX, renderInfo.mouseY); if (container != null) { container.convertFor(this, mouse); } if (mouse.getX() > 0 && mouse.getY() > 0 && mouse.getX() < lastSize.getWidth() && mouse.getY() < lastSize.getHeight()) { return tooltip; } } return null; }
@Override public boolean mouseClick(ReadablePoint position, int button) { if (getContainer() != null) { getContainer().convertFor(this, (Point) (position = new Point(position))); } boolean hovering = isMouseHovering(position); if (hovering && isFocused() && button == 0) { updateCurrentOffset(); int mouseX = position.getX() - BORDER; FontRenderer fontRenderer = getMinecraft().fontRendererObj; String text = this.text.substring(currentOffset); int textX = fontRenderer.trimStringToWidth(text, mouseX).length() + currentOffset; setCursorPosition(textX); return true; } setFocused(hovering); // Do not yet return true to allow focusables later in the event chain to be notified of the focus change return false; }
@Override public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) { super.draw(renderer, size, renderInfo); int width = size.getWidth(); int height = size.getHeight(); renderer.bindTexture(TEXTURE); // Draw background // We have to increase the border size as there is one pixel row which is part of the border while drawing // but isn't during position calculations due to shadows Utils.drawDynamicRect(renderer, width, height, TEXTURE_BG_X, TEXTURE_BG_Y, TEXTURE_BG_WIDTH, TEXTURE_BG_HEIGHT, BORDER_TOP + 1, BORDER_BOTTOM, BORDER_LEFT + 1, BORDER_RIGHT); // Draw slider int bodyWidth = size.getWidth() - BORDER_LEFT - BORDER_RIGHT; int barOffset = (int) (bodyWidth * offset) + BORDER_LEFT; int barWidth = (int) (bodyWidth * zoom); Utils.drawDynamicRect(new OffsetGuiRenderer(renderer, new Point(barOffset, BORDER_TOP), size), barWidth, height - (BORDER_TOP + 1) - BORDER_BOTTOM, TEXTURE_FG_X, TEXTURE_FG_Y, TEXTURE_FG_WIDTH, TEXTURE_FG_HEIGHT, 2, 1, 1, 1); }
@Override public boolean mouseClick(ReadablePoint position, int button) { Point point = new Point(position); getContainer().convertFor(this, point); if (point.getX() > 0 && point.getX() < getLastSize().getWidth() && point.getY() > 0 && point.getY() < getLastSize().getHeight()) { if (selected != this) { selected = this; onSelectionChanged(); } else if (System.currentTimeMillis() - selectedLastClickTime < DOUBLE_CLICK_INTERVAL) { onSelectionDoubleClicked(); } selectedLastClickTime = System.currentTimeMillis(); return true; } return false; }
@Override public boolean mouseClick(ReadablePoint position, int button) { if (getContainer() != null) { getContainer().convertFor(this, (Point) (position = new Point(position))); } boolean hovering = isMouseHovering(position); if (hovering && isFocused() && button == 0) { updateCurrentOffset(); int mouseX = position.getX() - BORDER; int mouseY = position.getY() - BORDER; FontRenderer fontRenderer = getMinecraft().fontRendererObj; int textY = clamp_int(mouseY / (fontRenderer.FONT_HEIGHT + LINE_SPACING) + currentYOffset, 0, text.length - 1); if (cursorY != textY) { currentXOffset = 0; } String line = text[textY].substring(currentXOffset); int textX = fontRenderer.trimStringToWidth(line, mouseX).length() + currentXOffset; setCursorPosition(textX, textY); } setFocused(hovering); return hovering; }
@SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { if (event.type == RenderGameOverlayEvent.ElementType.ALL) { updateRenderer(); int layers = getMaxLayer(); int mouseX = -1, mouseY = -1; if (mouseVisible) { Point mouse = MouseUtils.getMousePos(); mouseX = mouse.getX(); mouseY = mouse.getY(); } for (int layer = 0; layer <= layers; layer++) { draw(renderer, screenSize, new RenderInfo(event.partialTicks, mouseX, mouseY, layer)); } } }
private void updateDummyDepot() { if(dummyDepot != null) { dummyDepot.update(); Camera cam = Camera.getInstance(); ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + cam.getRectangle().getHeight()); // invertieren weil windows andere koordinaten liefert float isoMouseX = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) - ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)); float isoMouseY = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) + ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)) - 1; dummyDepot.setTilePos(new Vector2f(isoMouseX, isoMouseY)); if (Mouse.isButtonDown(0) && !mouseUp) { this.addEntity(new Depot(new Vector2f(isoMouseX, isoMouseY), true, BuildingStatic.depot, this)); dummyDepot = null; } // right click - enough build if (Mouse.isButtonDown(1)) { dummyDepot = null; } } }
private void updateDummyStreet() { if(dummyStreet == null){ return; } Camera cam = Camera.getInstance(); ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + cam.getRectangle().getHeight()); // invertieren weil windows andere koordinaten liefert float isoMouseX = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) - ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)); float isoMouseY = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) + ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)) - 1; dummyStreet.setTilePos(new Vector2f(isoMouseX, isoMouseY)); if (Mouse.isButtonDown(0) && !mouseUp) { this.addEntity(new Street(new Vector2f(isoMouseX, isoMouseY), StreetTID.urban_street_ns)); } // right click - enough build if (Mouse.isButtonDown(1)) { dummyStreet = null; } }
@Override public void update() { Point mousePoint = new Point(Mouse.getX(), -Mouse.getY() + (int)Window.getDisplay().getY()); if(this.collisionBox.contains(mousePoint) && Mouse.isButtonDown(0) && !mouseUp){ if(uiButtonAction != null) { uiButtonAction.fireAction(entityController); } if(this.linkedElement != null) { if (this.linkedElement.isVisible()) { this.linkedElement.setVisible(false); } else { this.linkedElement.setVisible(true); } } } mouseUp = Mouse.isButtonDown(0); }
@Override public void update() { // X Knöp ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + 800); // invertieren weil windows andere koordinaten liefert if(closeRectangle.contains(p) && Mouse.isButtonDown(0)) { gui.closeRequest(this.name); } // Elemente angeklickt for(GuiWindowElement guiWindowElement : this.guiWindowElements) { if(guiWindowElement.getRectangle().contains(p) && guiWindowElement.clickable && Mouse.isButtonDown(0)){ if( lastChosenGuiElement != null) {lastChosenGuiElement.chosen =false;} guiWindowElement.chosen = true; lastChosenGuiElement = guiWindowElement; } } }
/** * Draws the screen and all the components in it. */ // creaturelistgui.png @Override public void drawScreen(int par1, int par2, float par3) { this.drawDefaultBackground(); if (dataFields.get(currentDataField).isEnabled()) { dataFields.get(currentDataField).render(mc, par1, par2, par3, new Point(this.width, this.height), backgroundSize); } String titleString = "Edit Mob Spawner Settings " + Integer.toString(currentDataField) + "/" + Integer.toString(dataFields.size() - 1); fontRendererObj.drawString(titleString, (width - fontRendererObj.getStringWidth(titleString)) / 2, (height - backgroundSize.getY()) / 2 + 8, 4210752); // White: 16777215 super.drawScreen(par1, par2, par3); if (currentListType != ListType.NONE) { scrollingList.drawBackground(); scrollingList.drawScreen(new Point(this.width, this.height), backgroundSize, par1, par2, par3); } }
@Override public void render() { super.render(); if (draw == null || draw.getStack().getItem() != ItemRegistry.papyrus || !ItemRegistry.papyrus.getId(draw.getStack()).equals(step.id)) { draw = new ItemDrawable(ItemRegistry.papyrus.getPapyrusItem(step.id), 5); } DrawingTools.drawString(step.getDescription(), 5, draw.getHeight() + 5, Colors.WHITE, getWidth() - 5); Point pos = getPosOnScreen(); draw.drawWithTooltip(getGuiScreen(), (getWidth() - draw.getWidth()) / 2, 0, lastX, lastY, pos.getX(), pos.getY()); }
@Override public void render() { for (Point p : childs) { DrawingTools.drawLine(getWidth() / 2, getHeight() / 2, p.getX(), p.getY(), 3, getEntries().getTabletScreen().getTablet().data.getLineColorStart(), getEntries().getTabletScreen().getTablet().data.getLineColorEnd()); } if ((getX() + getWidth()) <= 0 || (getY() + getHeight()) <= 0 || getX() >= getEntries().getWidth() || getY() >= getEntries().getHeight()) return; int steps = Minecraft.getMinecraft().player.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null).getSteps(entry.getId()); float f = 1; if (getEntries().getTabletScreen().getTablet().data.isShouldGlow()) { if (entry.getSteps().size() == 0) f = 0; else f = 1 - (steps / (float) entry.getSteps().size()); } GlStateManager.pushMatrix(); GlStateManager.translate(0, 0, 1); GlStateManager.color(f, 1, f); GlStateManager.enableBlend(); getEntries().getTabletScreen().getTablet().data.getEntryBackground(entry, steps).draw(getGuiScreen(), 0, 0); GlStateManager.disableBlend(); GlStateManager.color(1, 1, 1); entry.getIcon().draw(getGuiScreen(), (getWidth() - entry.getIcon().getWidth()) / 2, (getHeight() - entry.getIcon().getHeight()) / 2); GlStateManager.popMatrix(); }
@Override public void render2() { Point pos = getPosOnScreen(); inDraw.drawTooltip(getGuiScreen(), xIn, yIn, lastX, lastY, pos.getX(), pos.getY()); outDraw.drawTooltip(getGuiScreen(), xOut, yOut, lastX, lastY, pos.getX(), pos.getY()); }
@Override public boolean mouseClick(ReadablePoint position, int button) { Point pos = new Point(position); if (getContainer() != null) { getContainer().convertFor(this, pos); } if (isMouseHovering(pos) && isEnabled()) { updateValue(pos); dragging = true; return true; } return false; }
@Override public boolean mouseDrag(ReadablePoint position, int button, long timeSinceLastCall) { if (dragging) { Point pos = new Point(position); if (getContainer() != null) { getContainer().convertFor(this, pos); } updateValue(pos); } return dragging; }
@Override public boolean mouseRelease(ReadablePoint position, int button) { if (dragging) { dragging = false; Point pos = new Point(position); if (getContainer() != null) { getContainer().convertFor(this, pos); } updateValue(pos); return true; } else { return false; } }
@Override public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) { super.draw(renderer, size, renderInfo); int width = size.getWidth(); int height = size.getHeight(); renderer.bindTexture(GuiButton.WIDGETS_TEXTURE); // Draw background renderer.drawTexturedRect(0, 0, 0, 46, width / 2, height); renderer.drawTexturedRect(width / 2, 0, 200 - width / 2, 46, width / 2, height); // Draw slider int sliderX = (width - 8) * value / steps; renderer.drawTexturedRect(sliderX, 0, 0, 66, 4, 20); renderer.drawTexturedRect(sliderX + 4, 0, 196, 66, 4, 20); // Draw text int color = 0xe0e0e0; if (!isEnabled()) { color = 0xa0a0a0; } else if (isMouseHovering(new Point(renderInfo.mouseX, renderInfo.mouseY))) { color = 0xffffa0; } renderer.drawCenteredString(width / 2, height / 2 - 4, color, text); }
@Override public boolean mouseClick(ReadablePoint position, int button) { Point pos = new Point(position); if (getContainer() != null) { getContainer().convertFor(this, pos); } if (isMouseHovering(pos) && isEnabled()) { onClick(); return true; } return false; }
@Override public boolean mouseClick(ReadablePoint position, int button) { Point pos = new Point(position); if (getContainer() != null) { getContainer().convertFor(this, pos); } if (isMouseHoveringBar(pos) && isEnabled()) { dragging = true; updateValue(pos); return true; } return false; }
@Override public boolean mouseRelease(ReadablePoint position, int button) { if (dragging) { Point pos = new Point(position); if (getContainer() != null) { getContainer().convertFor(this, pos); } updateValue(pos); dragging = false; startDragging = null; return true; } else { return false; } }
public static Point getMousePos() { Point scaled = getScaledDimensions(); int width = scaled.getX(); int height = scaled.getY(); int mouseX = (Mouse.getX() * width / mc.displayWidth); int mouseY = (height - Mouse.getY() * height / mc.displayHeight); return new Point(mouseX, mouseY); }
@Override public void convertFor(GuiElement element, Point point, int relativeLayer) { checkState(layedOutElements != null, "Cannot convert position unless rendered at least once."); Pair<ReadablePoint, ReadableDimension> pair = layedOutElements.get(element); checkState(pair != null, "Element " + element + " not part of " + this); ReadablePoint pos = pair.getKey(); if (getContainer() != null) { getContainer().convertFor(this, point, relativeLayer + getLayer()); } point.translate(-pos.getX(), -pos.getY()); }
@Override public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) { int y = 0; int spacing = 0; Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> map = new LinkedHashMap<>(); for (Map.Entry<GuiElement, LayoutData> entry : container.getElements().entrySet()) { y += spacing; spacing = this.spacing; GuiElement element = entry.getKey(); Data data = entry.getValue() instanceof Data ? (Data) entry.getValue() : DEFAULT_DATA; Dimension elementSize = new Dimension(element.getMinSize()); ReadableDimension elementMaxSize = element.getMaxSize(); elementSize.setHeight(Math.min(size.getHeight() - y, Math.min(elementSize.getHeight(), elementMaxSize.getHeight()))); elementSize.setWidth(Math.min(size.getWidth(), (data.maximizeWidth ? elementMaxSize : elementSize).getWidth())); int remainingWidth = size.getWidth() - elementSize.getWidth(); int x = (int) (data.alignment * remainingWidth); map.put(element, Pair.<ReadablePoint, ReadableDimension>of(new Point(x, y), elementSize)); y += elementSize.getHeight(); } if (alignment != Alignment.TOP) { int remaining = size.getHeight() - y; if (alignment == Alignment.CENTER) { remaining /= 2; } for (Pair<ReadablePoint, ReadableDimension> pair : map.values()) { ((Point) pair.getLeft()).translate(0, remaining); } } return map; }
@Override public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) { int x = 0; int spacing = 0; Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> map = new LinkedHashMap<>(); for (Map.Entry<GuiElement, LayoutData> entry : container.getElements().entrySet()) { x += spacing; spacing = this.spacing; GuiElement element = entry.getKey(); Data data = entry.getValue() instanceof Data ? (Data) entry.getValue() : DEFAULT_DATA; Dimension elementSize = new Dimension(element.getMinSize()); ReadableDimension elementMaxSize = element.getMaxSize(); elementSize.setWidth(Math.min(size.getWidth() - x, Math.min(elementSize.getWidth(), elementMaxSize.getWidth()))); elementSize.setHeight(Math.min(size.getHeight(), elementMaxSize.getHeight())); int remainingHeight = size.getHeight() - elementSize.getHeight(); int y = (int) (data.alignment * remainingHeight); map.put(element, Pair.<ReadablePoint, ReadableDimension>of(new Point(x, y), elementSize)); x += elementSize.getWidth(); } if (alignment != Alignment.LEFT) { int remaining = size.getWidth() - x; if (alignment == Alignment.CENTER) { remaining /= 2; } for (Pair<ReadablePoint, ReadableDimension> pair : map.values()) { ((Point) pair.getLeft()).translate(remaining, 0); } } return map; }
boolean pointInTriangle(Point pt, Point v1, Point v2, Point v3) { boolean b1, b2, b3; b1 = sign(pt, v1, v2) < 0.0f; b2 = sign(pt, v2, v3) < 0.0f; b3 = sign(pt, v3, v1) < 0.0f; return ((b1 == b2) && (b2 == b3)); }
public void buildDepot(){ if(dummyStreet != null) { dummyStreet = null; } Camera cam = Camera.getInstance(); ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + cam.getRectangle().getHeight()); dummyDepot = new Depot(new Vector2f(new Vector2f(p.getX(), p.getY())), false, BuildingStatic.depot, this); }
public void buildSteet() { if(dummyDepot != null) { dummyDepot = null; } Camera cam = Camera.getInstance(); ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + cam.getRectangle().getHeight()); dummyStreet = new Street(new Vector2f(p.getX(), p.getY()),StreetTID.urban_cross); }
@Override public void update() { for(int i = 0; i < nearbyindustry.size(); i++) { if(((Industry)nearbyindustry.get(i)).getType() == IndustryType.Farm) { storage.addGoods(Goods.Food, ((Industry)nearbyindustry.get(i)).getAvailableAmount()); } if(((Industry)nearbyindustry.get(i)).getType() == IndustryType.Wood) { storage.addGoods(Goods.Furniture, ((Industry)nearbyindustry.get(i)).getAvailableAmount() / 25); } } Camera cam = Camera.getInstance(); ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + cam.getRectangle().getHeight()); // invertieren weil windows andere koordinaten liefert float isoMouseX = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) - ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)); float isoMouseY = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) + ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)) - 1; if(this.getTilePos().getX() == isoMouseX && this.getTilePos().getY() == isoMouseY && Mouse.isButtonDown(0) && !mouseUp) { if (isPlaced) { if(!DepotMenueVendor.getDepotMenue().isVisible()) { DepotMenueVendor.getDepotMenue().setVisible(true); DepotMenueVendor.startPos = this.getTilePos(); DepotMenueVendor.startDepot = this; } } } mouseUp = Mouse.isButtonDown(0); }
@Override public void update() { if(isVisible()) { for (UIButton e : this.buildMenuButtons) { e.update(); } Camera cam = Camera.getInstance(); ReadablePoint p = new org.lwjgl.util.Point(Mouse.getX(), -Mouse.getY() + cam.getRectangle().getHeight()); // invertieren weil windows andere koordinaten liefert float isoMouseX = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) - ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)); float isoMouseY = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) + ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)) - 1; if(isoMouseX > 0 && isoMouseY > 0 && ec.getEntityVec((int)isoMouseX, (int)isoMouseY) != null && ec.getEntityVec((int)isoMouseX, (int)isoMouseY).getClass() == Depot.class && Mouse.isButtonDown(0) &&!mouseUp) { if(DepotMenueVendor.startPos.getX() != (int)isoMouseX && DepotMenueVendor.startPos.getY() != (int)isoMouseY) { endDepot = ec.getEntityVec((int) isoMouseX, (int) isoMouseY); endChosen = true; } } if(endDepot != null && createCarAction.getCollisionBox().contains(new Point(Mouse.getX(), -Mouse.getY() + (int) de.fhstralsund.opentransport.Window.getDisplay().getY())) && Mouse.isButtonDown(0) && !mouseUp) { createCarAction.getUiButtonAction().fireAction(ec, DepotMenueVendor.startPos, endDepot); cancelGui(); } if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { cancelGui(); } mouseUp = Mouse.isButtonDown(0); } }
public void update(EntityController entityController) { ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + 800); // invertieren weil windows andere koordinaten liefert if(closeRectangle.contains(p) && Mouse.isButtonDown(0)) { gui.closeRequest(this.name); } // Elemente angeklickt for(GuiWindowElement guiWindowElement : this.guiWindowElements) { if(guiWindowElement.getRectangle().contains(p) && guiWindowElement.clickable && Mouse.isButtonDown(0)){ if( lastChosenGuiElement != null) {lastChosenGuiElement.chosen =false;} guiWindowElement.chosen = true; lastChosenGuiElement = guiWindowElement; } // gui element ausgewählt, es soll platziert werden else if(Mouse.isButtonDown(0) && !windowRectangle.contains(p)) { if (lastChosenGuiElement != null) { Camera cam = Camera.getInstance(); // Mouse to Iso-Tiles float isoMouseX = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) - ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)); float isoMouseY = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) + ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT))-1; if(isoMouseX >= 0 && isoMouseY >= 0 && isoMouseX < cam.getSize() && isoMouseY < cam.getSize()) { if(gui.rl.getTextureID("res" + File.separator + "delete.png") == lastChosenGuiElement.getTextureID()) { entityController.remove(new Vector2f(isoMouseX, isoMouseY)); } else{ entityController.addEntity(new Street(new Vector2f(isoMouseX, isoMouseY), lastChosenGuiElement.getTextureID())); } } } } } }
public GUINBTList(CreatureFields parent, Minecraft mc, NBTTree nodeTree, int listWidth, Point screenSize, Point backgroundSize) { super(mc, listWidth, backgroundSize.getY() + 50, // Width, Height (screenSize.getY() - backgroundSize.getY()) / 2 + 100 - 14, (screenSize.getY() - backgroundSize.getY()) / 2 + backgroundSize.getY() - 60 - 12, // Top, Bottom, (screenSize.getX() - backgroundSize.getX()) / 2 + 6, // Left mc.fontRenderer.FONT_HEIGHT + 8); // Element Height this.parent = parent; this.nodeTree = nodeTree; this.nodeList = nodeTree.toArrayList(); this.screenSize = screenSize; this.backgroundSize = backgroundSize; }
public void drawScreen(Point screenSize, Point backgroundSize, int mouseX, int mouseY, float p_22243_3_) { super.drawScreen(mouseX, mouseY, p_22243_3_); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_DEPTH_TEST); drawScrollOverlay(this.left, (screenSize.getY() - backgroundSize.getY()) / 2 + 55, this.top, 255, 255); // Top // Overlay drawScrollOverlay(this.left, this.bottom, (screenSize.getY() - backgroundSize.getY()) / 2 + backgroundSize.getY() - 4, 255, 255); // Bot Overlay // GL11.glEnable(GL11.GL_DEPTH_TEST); // GL11.glDisable(GL11.GL_TEXTURE_2D); }
public GUIEditNodeTextField(GUIEditNodeTextField oldTextFields, FontRenderer fontRenderer, int maxTextChars, Point screenSize, Point backgroundSize, Point position, Point boxSize) { this(fontRenderer, (screenSize.getX() - backgroundSize.getX()) / 2 + position.getX(), (screenSize.getY() - backgroundSize.getY()) / 2 + position.getY(), boxSize.getX(), boxSize.getY()); this.selectedNode = oldTextFields.selectedNode; setText(oldTextFields.getText()); setupTextField(30000); }
@Override public DataFields createFields(Minecraft mc, int screenWidth, int screenHeight, Point backgroundSize) { minSpawnDelay = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point(177, 22 + 2), new Point(20, 14), minSpawnDelay != null ? minSpawnDelay.getText() : ""); maxSpawnDelay = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point(201, 22 + 2), new Point(20, 14), maxSpawnDelay != null ? maxSpawnDelay.getText() : ""); requiredPlayerRange = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point(201, 39 + 2), new Point(39, 14), requiredPlayerRange != null ? requiredPlayerRange.getText() : ""); maxToSpawn = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point( 201, 58), new Point(20, 14), maxToSpawn != null ? maxToSpawn.getText() : ""); maxNearbyEntities = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point(201, 58 + 17), new Point(39, 14), maxNearbyEntities != null ? maxNearbyEntities.getText() : ""); spawnRangeVertical = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point(201, 58 + 17 * 2), new Point(20, 14), spawnRangeVertical != null ? spawnRangeVertical.getText() : ""); spawnRangeHorizontal = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point(177, 58 + 17 * 2), new Point(20, 14), spawnRangeHorizontal != null ? spawnRangeHorizontal.getText() : ""); spawnOffsetX = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point( 177, 58 + 17 * 3), new Point(20, 14), spawnOffsetX != null ? spawnOffsetX.getText() : ""); spawnOffsetZ = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point( 201, 58 + 17 * 3), new Point(20, 14), spawnOffsetZ != null ? spawnOffsetZ.getText() : ""); spawnOffsetY = setupTextField(mc.fontRenderer, new Point(screenWidth, screenHeight), backgroundSize, new Point( 201, 58 + 17 * 4), new Point(20, 14), spawnOffsetY != null ? spawnOffsetY.getText() : ""); toggleDebug = new GuiButton(1, (screenWidth - backgroundSize.getX()) / 2 + 5, (screenHeight - backgroundSize.getY()) / 2 + 175, 70, 20, "Toggle Debug"); resetDebug = new GuiButton(1, (screenWidth - backgroundSize.getX()) / 2 + 151, (screenHeight - backgroundSize.getY()) / 2 + 175, 70, 20, "Reset Debug"); return this; }
private GuiTextField setupTextField(FontRenderer fontRenderer, Point screenSize, Point backgroundSize, Point position, Point boxSize, String text) { GuiTextField newTextField = new GuiTextField(fontRenderer, (screenSize.getX() - backgroundSize.getX()) / 2 + position.getX(), (screenSize.getY() - backgroundSize.getY()) / 2 + position.getY(), boxSize.getX(), boxSize.getY()); newTextField.setText(text); newTextField.setTextColor(-1); newTextField.setDisabledTextColour(-1); newTextField.setEnableBackgroundDrawing(false); newTextField.setMaxStringLength(3); return newTextField; }