mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-11-21 12:42:45 +00:00
Co-authored-by: lordIcocain <[email protected]> Co-authored-by: Maya <[email protected]> Co-authored-by: Martin Robertz <[email protected]> Co-authored-by: NeOzay <[email protected]> Co-authored-by: Ethryan <[email protected]> Co-authored-by: NeOzay <[email protected]> Co-authored-by: PLASMAchicken <[email protected]> Co-authored-by: Kogepan229 <[email protected]>
60 lines
1.6 KiB
Java
60 lines
1.6 KiB
Java
package appeng.client.gui.widgets;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
public class GuiCheckBox extends GuiToggleButton {
|
|
|
|
final double scale;
|
|
|
|
public GuiCheckBox(double scale, int x, int y, String DisplayName, String DisplayHint) {
|
|
this(scale, x, y, 16 * 7 + 12, 16 * 7 + 11, DisplayName, DisplayHint);
|
|
}
|
|
|
|
public GuiCheckBox(double scale, int x, int y, int iconOn, int iconOff, String DisplayName, String DisplayHint) {
|
|
super(x, y, iconOn, iconOff, DisplayName, DisplayHint);
|
|
this.scale = scale;
|
|
this.xPosition = (int) Math.ceil(this.xPosition / scale);
|
|
this.yPosition = (int) Math.ceil(this.yPosition / scale);
|
|
}
|
|
|
|
@Override
|
|
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
|
GL11.glPushMatrix();
|
|
GL11.glScaled(scale, scale, scale);
|
|
super.drawButton(par1Minecraft, par2, par3);
|
|
GL11.glPopMatrix();
|
|
|
|
}
|
|
|
|
@Override
|
|
public int xPos() {
|
|
return (int) Math.ceil(this.xPosition * scale);
|
|
}
|
|
|
|
@Override
|
|
public int yPos() {
|
|
return (int) Math.ceil(this.yPosition * scale);
|
|
}
|
|
|
|
@Override
|
|
public int getWidth() {
|
|
return (int) Math.ceil(this.width * scale);
|
|
}
|
|
|
|
@Override
|
|
public int getHeight() {
|
|
return (int) Math.ceil(this.height * scale);
|
|
}
|
|
|
|
@Override
|
|
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
|
return this.enabled && this.visible
|
|
&& mouseX >= xPos()
|
|
&& mouseY >= yPos()
|
|
&& mouseX < xPos() + getWidth()
|
|
&& mouseY < yPos() + getHeight();
|
|
}
|
|
}
|