Fixed up the GUI a bit.

This commit is contained in:
CrazyPants committed 2014-04-20 02:27:54 +08:00
1 parent c18aa13b5d
commit 69c5a678d3
9 files changed
+49 -47

No files matched your search

@@ -28,4 +28,6 @@ public interface IGuiOverlay {
boolean handleMouseInput(int x, int y, int b);
boolean isMouseInBounds(int mouseX, int mouseY);
}
@@ -70,6 +70,9 @@ public final class IconEIO {
public static final IconEIO LOOP = new IconEIO(86, 236, 20, 20);
public static final IconEIO LOOP_OFF = new IconEIO(106, 236, 20, 20);
public static final IconEIO IO_CONFIG_UP = new IconEIO(80, 116, 24, 24);
public static final IconEIO IO_CONFIG_DOWN = new IconEIO(104, 116, 24, 24);
private static final int TEX_SIZE = 256;
private static final double PIX_SIZE = 1d / TEX_SIZE;
@@ -277,13 +277,16 @@ public class IoConfigRenderer {
private void doRender() {
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
//
RenderHelper.disableStandardItemLighting();
mc.entityRenderer.enableLightmap(0);
//mc.entityRenderer.enableLightmap(0);
mc.entityRenderer.disableLightmap(0);
RenderUtil.bindBlockTexture();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z);
for (int pass = 0; pass < 2; pass++) {
for (int pass = 0; pass < 1; pass++) {
setGlStateForPass(pass, false);
doWorldRenderPass(trans, configurables, pass);
setGlStateForPass(pass, true);
@@ -303,7 +306,7 @@ public class IoConfigRenderer {
doTileEntityRenderPass(configurables, pass);
setGlStateForPass(pass, true);
//if(pass == 2) {
doTileEntityRenderPass(neighbours, pass);
//doTileEntityRenderPass(neighbours, pass);
//}
}
ForgeHooksClient.setRenderPass(-1);
@@ -356,12 +359,14 @@ public class IoConfigRenderer {
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glBlendFunc(GL11.GL_CONSTANT_ALPHA, GL11.GL_CONSTANT_ALPHA);
GL14.glBlendColor(1.0f, 1.0f, 1.0f, 0.8f);
//GL14.glBlendColor(1.0f, 1.0f, 1.0f, 0.8f);
GL14.glBlendColor(0.0f, 0.0f, 0.0f, 0.8f);
GL11.glDepthMask(true);
} else {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_CONSTANT_ALPHA);
GL14.glBlendColor(1.0f, 1.0f, 1.0f, 0.8f);
//GL14.glBlendColor(1.0f, 1.0f, 1.0f, 0.8f);
GL14.glBlendColor(0.0f, 0.0f, 0.0f, 0.8f);
GL11.glDepthMask(false);
}
return;
@@ -52,9 +52,18 @@ public abstract class GuiMachineBase extends GuiContainerBase {
redstoneButton = new RedstoneModeButton(this, -1, x, y, tileEntity, new BlockCoord(tileEntity));
y += 20;
configB = new IconButtonEIO(this, CONFIG_ID, x, y, IconEIO.BUTTON_DOWN);
configB = new IconButtonEIO(this, CONFIG_ID, x, y, IconEIO.IO_CONFIG_UP);
configB.setToolTip("Toggles the IO config overlay.");
configOverlay = new GuiOverlayIoConfig(machine);
configOverlay = new GuiOverlayIoConfig(machine) {
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
configB.setIcon(visible ? IconEIO.IO_CONFIG_DOWN : IconEIO.IO_CONFIG_UP);
}
};
addOverlay(configOverlay);
}
@@ -78,7 +87,8 @@ public abstract class GuiMachineBase extends GuiContainerBase {
protected void actionPerformed(GuiButton b) {
super.actionPerformed(b);
if(b.id == CONFIG_ID) {
configOverlay.setVisible(!configOverlay.isVisible());
boolean vis = !configOverlay.isVisible();
configOverlay.setVisible(vis);
}
}
@@ -105,4 +115,6 @@ public abstract class GuiMachineBase extends GuiContainerBase {
}
}
@@ -61,7 +61,7 @@ public class GuiOverlayIoConfig implements IGuiOverlay {
@Override
public boolean handleMouseInput(int x, int y, int b) {
if(!mouseInBounds(x, y)) {
if(!isMouseInBounds(x, y)) {
renderer.handleMouseInput();
return false;
}
@@ -70,7 +70,8 @@ public class GuiOverlayIoConfig implements IGuiOverlay {
return true;
}
private boolean mouseInBounds(int mouseX, int mouseY) {
@Override
public boolean isMouseInBounds(int mouseX, int mouseY) {
int x = mouseX - screen.getGuiLeft();
int y = mouseY - screen.getGuiTop();
if(bounds.contains(x,y)) {
@@ -56,7 +56,6 @@ public class PacketIoMode implements IPacketEio {
}
private void handle(EntityPlayer player) {
System.out.println("PacketIoMode.handle: ");
TileEntity te = player.worldObj.getTileEntity(x, y, z);
if(te instanceof IIoConfigurable) {
IIoConfigurable me = (IIoConfigurable) te;
@@ -56,38 +56,6 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
ttMan.addToolTip(toolTip);
}
// @Override
// protected void mouseClicked(int par1, int par2, int par3) {
// for(IGuiOverlay overlay : overlays) {
// if(overlay != null && overlay.isVisible() && overlay.mouseClicked(par1, par2, par3)) {
// return;
// }
// }
// super.mouseClicked(par1, par2, par3);
// }
//
// @Override
// protected void mouseClickMove(int par1, int par2, int par3, long par4) {
// for(IGuiOverlay overlay : overlays) {
// if(overlay != null && overlay.isVisible() && overlay.mouseClickMove(par1, par2, par3, par4)) {
// return;
// }
// }
// super.mouseClickMove(par1, par2, par3, par4);
// }
//
// @Override
// protected void mouseMovedOrUp(int par1, int par2, int par3) {
// for(IGuiOverlay overlay : overlays) {
// if(overlay != null && overlay.isVisible() && overlay.mouseMovedOrUp(par1, par2, par3)) {
// return;
// }
// }
// super.mouseMovedOrUp(par1, par2, par3);
// }
@Override
public void handleMouseInput() {
int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
@@ -101,10 +69,22 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
super.handleMouseInput();
}
@Override
protected boolean func_146978_c(int p_146978_1_, int p_146978_2_, int p_146978_3_, int p_146978_4_, int p_146978_5_, int p_146978_6_) {
int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
int b = Mouse.getEventButton();
for(IGuiOverlay overlay : overlays) {
if(overlay != null && overlay.isVisible() && overlay.isMouseInBounds(x, y)) {
return false;
}
}
return super.func_146978_c(p_146978_1_, p_146978_2_, p_146978_3_, p_146978_4_, p_146978_5_, p_146978_6_);
}
@Override
public void handleKeyboardInput() {
// TODO Auto-generated method stub
super.handleKeyboardInput();
}
@@ -130,8 +110,8 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
int my = par2;
for(IGuiOverlay overlay : overlays) {
if(overlay != null && overlay.isVisible() && isMouseInOverlay(par1, par2, overlay)) {
mx = -1;
my = -1;
mx = -5000;
my = -5000;
}
}