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);
}
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);
}
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);
}
}
Aggregations