summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/gui/button/GuiButtonDestination.java
blob: ea00477ba46c53fb73cef9fa2ac3474bbfe05a68 (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
package jp.plusplus.fbs.gui.button;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;

/**
 * Created by plusplus_F on 2015/10/22.
 */
public class GuiButtonDestination extends GuiButton {
    public boolean selected;

    public GuiButtonDestination(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_) {
        super(p_i1020_1_, p_i1020_2_, p_i1020_3_,86 ,20, "");
        enabled=false;
    }

    public void setDisplayString(String str){
        displayString=str;
        enabled=!str.isEmpty();
    }

    @Override
    public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) {
        if (this.enabled && !displayString.isEmpty()) {
            FontRenderer fontrenderer = p_146112_1_.fontRenderer;
            this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
            int col=selected?0xffffff:0x404040;

            this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 16) / 2, col);
        }
    }
}