Search in sources :

Example 1 with SizedTextureArea

use of gregtech.api.gui.resources.SizedTextureArea in project GregTech by GregTechCE.

the class ClickButtonWidget method drawInBackground.

@Override
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    super.drawInBackground(mouseX, mouseY, context);
    Position position = getPosition();
    Size size = getSize();
    if (buttonTexture instanceof SizedTextureArea) {
        ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height, 0.0, 1.0);
    } else {
        buttonTexture.drawSubArea(position.x, position.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
    }
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    String text = I18n.format(displayText);
    fontRenderer.drawString(text, position.x + size.width / 2 - fontRenderer.getStringWidth(text) / 2, position.y + size.height / 2 - fontRenderer.FONT_HEIGHT / 2, textColor);
    GlStateManager.color(1.0f, 1.0f, 1.0f);
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) SizedTextureArea(gregtech.api.gui.resources.SizedTextureArea) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 2 with SizedTextureArea

use of gregtech.api.gui.resources.SizedTextureArea in project GregTech by GregTechCE.

the class CycleButtonWidget method drawInBackground.

@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    Position pos = getPosition();
    Size size = getSize();
    if (buttonTexture instanceof SizedTextureArea) {
        ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, 0.0, 1.0);
    } else {
        buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
    }
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    String text = I18n.format(optionNames[currentOption]);
    fontRenderer.drawString(text, pos.x + size.width / 2 - fontRenderer.getStringWidth(text) / 2, pos.y + size.height / 2 - fontRenderer.FONT_HEIGHT / 2 + 1, textColor);
    GlStateManager.color(1.0f, 1.0f, 1.0f);
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) SizedTextureArea(gregtech.api.gui.resources.SizedTextureArea) FontRenderer(net.minecraft.client.gui.FontRenderer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with SizedTextureArea

use of gregtech.api.gui.resources.SizedTextureArea in project GregTech by GregTechCE.

the class ToggleButtonWidget method drawInBackground.

@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    Position pos = getPosition();
    Size size = getSize();
    if (buttonTexture instanceof SizedTextureArea) {
        ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, isPressed ? 0.5 : 0.0, 0.5);
    } else {
        buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, isPressed ? 0.5 : 0.0, 1.0, 0.5);
    }
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) SizedTextureArea(gregtech.api.gui.resources.SizedTextureArea) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

SizedTextureArea (gregtech.api.gui.resources.SizedTextureArea)3 Position (gregtech.api.util.Position)3 Size (gregtech.api.util.Size)3 FontRenderer (net.minecraft.client.gui.FontRenderer)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2