Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Ignite.gui.clickgui;
- import Ignite.Ignite;
- import Ignite.gui.clickgui.elements.Button;
- import Ignite.modules.Module;
- import Ignite.modules.ModuleCategory;
- import Ignite.utils.render.RenderUtils;
- import com.google.common.collect.Lists;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.Gui;
- import net.minecraft.client.gui.GuiScreen;
- import net.minecraft.client.gui.ScaledResolution;
- import net.minecraft.util.ResourceLocation;
- import org.lwjgl.input.Keyboard;
- import org.lwjgl.input.Mouse;
- import org.lwjgl.opengl.GL11;
- import java.awt.*;
- import java.io.IOException;
- import java.util.List;
- public class ClickGUI extends GuiScreen {
- protected List<Button> categoryButtons = Lists.<Button>newArrayList();
- protected List<Button> modButtons = Lists.<Button>newArrayList();
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- RenderUtils.drawRoundedRectangle(width / 2 - 700 / 2, height / 2 - (600 / 2 - 100), width / 2 - 700 / 2 + 700, height / 2 + (600 / 2 - 100), 20, new Color(28, 28, 28, 255).getRGB());
- RenderUtils.drawCustomImage(width / 2 - 800 / 2 + 120, height / 2 - (600 / 2 - 120), 85, 85, new ResourceLocation("/textures/gui/title/logo480.png"));
- for(Button button : categoryButtons){
- button.drawButton(mc,mouseX,mouseY,partialTicks);
- }
- int wheel = Mouse.getDWheel();
- for (Button m : modButtons) {
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
- this.glScissor((double) new ScaledResolution(Minecraft.getMinecraft()).getScaledWidth() / 2 - 205, (double) new ScaledResolution(Minecraft.getMinecraft()).getScaledHeight() / 2 - 118, (double) new ScaledResolution(Minecraft.getMinecraft()).getScaledWidth() / 2 + 205, 235);
- m.drawButton(mc,mouseX,mouseY,partialTicks);
- if (wheel < 0) {
- m.y -= 16;
- } else if (wheel > 0) {
- m.y += 16;
- }
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
- }
- }
- @Override
- public void initGui() {
- categoryButtons.add(new Button(width / 2 - 700 / 2 + 30, this.height / 2 - 60, 80, 25, "Combat", false));
- categoryButtons.add(new Button(width / 2 - 700 / 2 + 30, this.height / 2, 80, 25, "Visual", false));
- categoryButtons.add(new Button(width / 2 - 700 / 2 + 30, this.height / 2 + 60, 100, 25, "Miscellaneous", false));
- }
- @Override
- protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
- if(mouseButton == 0) {
- for (Button button : categoryButtons) {
- if (button.mouseClicked(mouseX, mouseY, mouseButton)) {
- if (button.getButtonText().equalsIgnoreCase("combat")) {
- int yOffset = 0;
- modButtons.clear();
- for (Module m : Ignite.instance.getModulesInType(ModuleCategory.COMBAT)) {
- modButtons.add(new Button(width / 2 - 100, this.height / 2 - 110 + yOffset, 350, 40, m.name, true));
- yOffset += 50;
- }
- } else if (button.getButtonText().equalsIgnoreCase("visual")) {
- int yOffset = 0;
- modButtons.clear();
- for (Module m : Ignite.instance.getModulesInType(ModuleCategory.VISUAL)) {
- modButtons.add(new Button(width / 2 - 100, this.height / 2 - 110 + yOffset, 350, 40, m.name, true));
- yOffset += 50;
- }
- } else if (button.getButtonText().equalsIgnoreCase("miscellaneous")) {
- int yOffset = 0;
- modButtons.clear();
- for (Module m : Ignite.instance.getModulesInType(ModuleCategory.MISC)) {
- modButtons.add(new Button(width / 2 - 100, this.height / 2 - 110 + yOffset, 350, 40, m.name, true));
- yOffset += 50;
- }
- }
- }
- }
- for (Button button : modButtons) {
- if (button.mouseClicked(mouseX, mouseY, mouseButton)) {
- Ignite.getModuleByName(button.getButtonText()).toggle();
- }
- }
- } else if(mouseButton == 1) {
- for (Button button : modButtons) {
- if (button.mouseClicked(mouseX, mouseY, mouseButton)) {
- if (button.isExpandable())
- button.setExpanded(!button.isExpanded());
- }
- }
- }
- }
- private void glScissor(double x, double y, double width, double height) {
- y += height;
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- Minecraft mc = Minecraft.getMinecraft();
- GL11.glScissor((int) ((x * mc.displayWidth) / scaledResolution.getScaledWidth()),
- (int) (((scaledResolution.getScaledHeight() - y) * mc.displayHeight) / scaledResolution.getScaledHeight()),
- (int) (width * mc.displayWidth / scaledResolution.getScaledWidth()),
- (int) (height * mc.displayHeight / scaledResolution.getScaledHeight()));
- }
- @Override
- protected void keyTyped(char typedChar, int keyCode) throws IOException {
- if(keyCode == Keyboard.KEY_ESCAPE || keyCode == Keyboard.KEY_RSHIFT){
- Ignite.getModuleByName("clickgui").toggle();
- }
- super.keyTyped(typedChar, keyCode);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement