From 804e6561deab8084e268b90e037c3f504c909f4f Mon Sep 17 00:00:00 2001 From: Detrav Date: Tue, 22 Mar 2016 11:19:22 +0300 Subject: Add borders for gui --- src/main/java/com/detrav/gui/DetravGuiProPick.java | 41 ++++++++++++++------- .../assets/gregtech/textures/gui/propick.png | Bin 0 -> 1250 bytes 2 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 src/main/resources/assets/gregtech/textures/gui/propick.png diff --git a/src/main/java/com/detrav/gui/DetravGuiProPick.java b/src/main/java/com/detrav/gui/DetravGuiProPick.java index 112521adcc..80b64ba254 100644 --- a/src/main/java/com/detrav/gui/DetravGuiProPick.java +++ b/src/main/java/com/detrav/gui/DetravGuiProPick.java @@ -7,7 +7,9 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; import java.util.ArrayList; import java.util.Collections; @@ -41,39 +43,52 @@ public class DetravGuiProPick extends GuiScreen { int prevH; + private static int minHeight = 128; + private static int minWidth = 128; + + private static final ResourceLocation back = new ResourceLocation("gregtech:textures/gui/propick.png"); + @Override public void drawScreen(int x, int y, float f) { this.drawDefaultBackground(); if(map!=null) { - List keys = new ArrayList(map.ores.keySet()); - Collections.sort(keys); - int w = 0; - for(String item : keys) - { - w = Math.max(fontRendererObj.getStringWidth(item),w); - } - w+=10; - - int aX = (this.width - map.width-100)/2; - int aY = (this.height - map.height)/2; + int currentWidth = Math.max(map.width,minWidth); + int currentHeight = Math.max(map.height,minHeight); + int aX = (this.width - currentWidth-100)/2; + int aY = (this.height - currentHeight)/2; if(ores == null) { - ores = new ListOres(this,100,map.height,aY,aY+map.height,aX+map.width,10,map.ores); + ores = new ListOres(this,100,currentHeight,aY,aY+currentHeight,aX+currentWidth,10,map.ores); prevW = width; prevH = height; } if(prevW!=width || prevH !=height) { - ores = new ListOres(this,100,map.height,aY,aY+map.height,aX+map.width,10,map.ores); + ores = new ListOres(this,100,currentHeight,aY,aY+currentHeight,aX+currentWidth,10,map.ores); prevW = width; prevH = height; } + + //dradback for ores + drawRect(aX,aY,aX+currentWidth+100,aY+currentHeight,0xFFC6C6C6); map.glBindTexture(); map.draw(aX,aY); ores.drawScreen(x,y,f); + mc.getTextureManager().bindTexture(back); + GL11.glColor4f(0xFF, 0xFF, 0xFF, 0xFF); + //drawcorners + drawTexturedModalRect(aX-5,aY-5,0,0,5,5);//leftTop + drawTexturedModalRect(aX+currentWidth+100,aY-5,171,0,5,5);//RightTop + drawTexturedModalRect(aX-5,aY+currentHeight,0,161,5,5);//leftDown + drawTexturedModalRect(aX+currentWidth+100,aY+currentHeight,171,161,5,5);//RightDown + //draw edges + for(int i = aX;i