summaryrefslogtreecommitdiff
path: root/ihl/utils/GuiMultiTextureButton.java
blob: 009c57f048e789a6a94219a9eed67ed87f51fcf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package ihl.utils;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;

@SideOnly(value = Side.CLIENT)
public class GuiMultiTextureButton extends GuiButton {

    private ResourceLocation texture;
    private int textureX;
    private int textureY;
    private int textureActiveX;
    private int textureActiveY;
    public boolean isActive=false;
    
	public GuiMultiTextureButton(int id1, int x, int y, int w, int h,
			ResourceLocation texture1, int textureX1, int textureY1, int textureActiveX1, int textureActiveY1) {
        super(id1, x, y, w, h, "");
        texture=texture1;
        textureX=textureX1;
        textureY=textureY1;
        textureActiveX=textureActiveX1;
        textureActiveY=textureActiveY1;
        
	}
	
	@Override
   public void drawButton(Minecraft minecraft, int i, int j)
    {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        minecraft.getTextureManager().bindTexture(this.texture);
        if(this.isActive)
        {
        	this.drawTexturedModalRect(this.xPosition, this.yPosition, this.textureActiveX, this.textureActiveY, this.width, this.height);
        }
        else
        {
            this.drawTexturedModalRect(this.xPosition, this.yPosition, this.textureX, this.textureY, this.width, this.height);
        }
    }

}