Little work on PDA
This commit is contained in:
parent
4d8dd1ea4a
commit
214dacffe5
3 changed files with 57 additions and 9 deletions
44
src/main/java/techreborn/pda/GuiButtonCustomTexture.java
Normal file
44
src/main/java/techreborn/pda/GuiButtonCustomTexture.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package techreborn.pda;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiButtonExt;
|
||||
|
||||
public class GuiButtonCustomTexture extends GuiButtonExt {
|
||||
|
||||
public int textureU;
|
||||
public int textureV;
|
||||
public ResourceLocation texture;
|
||||
|
||||
public GuiButtonCustomTexture(int id, int xPos, int yPos, int u, int v, int width,
|
||||
int height, ResourceLocation loc)
|
||||
{
|
||||
super(id, xPos, yPos, width, height, "_");
|
||||
textureU = u;
|
||||
textureV = v;
|
||||
texture = loc;
|
||||
}
|
||||
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(texture);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
u += width;
|
||||
}
|
||||
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package techreborn.pda;
|
||||
|
||||
import techreborn.init.ModBlocks;
|
||||
import cpw.mods.fml.client.config.GuiButtonExt;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -11,30 +14,31 @@ public class GuiPda extends GuiScreen{
|
|||
private int guiLeft, guiTop;
|
||||
|
||||
private static final ResourceLocation pdaGuipages = new ResourceLocation("techreborn:" + "textures/gui/pda.png");
|
||||
public static final ResourceLocation buttonOre = new ResourceLocation("techreborn:" + "textures/blocks/ore/book_of_revealing");
|
||||
|
||||
public GuiPda(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.guiLeft = this.width / 2 - this.guiWidth / 2;
|
||||
this.guiTop = this.height / 2 - this.guiHeight / 2;
|
||||
GuiButtonCustomTexture oresButton = new GuiButtonCustomTexture(1, guiLeft +20, guiTop +20, 0, 224, 16, 16, buttonOre);
|
||||
|
||||
buttonList.add(oresButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
// this.fontRendererObj.setUnicodeFlag(true);
|
||||
this.mc.getTextureManager().bindTexture(pdaGuipages);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.guiWidth, this.guiHeight);
|
||||
|
||||
mc.getTextureManager().bindTexture(pdaGuipages);
|
||||
drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.guiWidth, this.guiHeight);
|
||||
mc.renderEngine.bindTexture(buttonOre);
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 434 B |
Loading…
Reference in a new issue