com.sr2610.steampunkd.client.gui.handbook.buttons.GuiBackButton.java Source code

Java tutorial

Introduction

Here is the source code for com.sr2610.steampunkd.client.gui.handbook.buttons.GuiBackButton.java

Source

/**
 * This class was created by <SR2610>.  It is distributed as
 * part of the Steampunk'd Mod. Get the Source Code on Github:
 * https://github.com/SR2610/Steampunkd.
 *
 * Steampunk'd is Open Source and distributed under a Creative Commons
 * Attribution-NonCommercial-ShareAlike 3.0 License
 * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
 */
package com.sr2610.steampunkd.client.gui.handbook.buttons;

import org.lwjgl.opengl.GL11;

import com.sr2610.steampunkd.client.gui.handbook.GuiHandbook;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;

public class GuiBackButton extends GuiButton {

    public GuiBackButton(int buttonID, int x, int y) {
        super(buttonID, x, y, 18, 9, "");
    }

    @Override
    public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
        hovered = (mouseX >= xPosition) && (mouseY >= yPosition) && (mouseX < (xPosition + width))
                && (mouseY < (yPosition + height));
        final int hoverState = getHoverState(hovered);

        minecraft.renderEngine.bindTexture(GuiHandbook.texture);
        GL11.glColor4f(1F, 1F, 1F, 1F);
        drawTexturedModalRect(xPosition, yPosition, 36, hoverState == 2 ? 180 : 189, 18, 9);

    }

}