This commit is contained in:
kirillsaint 2023-07-07 19:54:05 +06:00
parent 86195e8791
commit b3b0e35f09
33 changed files with 460 additions and 1267 deletions

View File

@ -12,7 +12,6 @@ import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.clickgui.TabButton;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils.Scroll;
import net.silentclient.client.gui.elements.Button;
@ -20,9 +19,10 @@ import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.Sounds;
import net.silentclient.client.utils.types.PlayerResponse.Account.Cosmetics.CosmeticItem;
@ -60,27 +60,27 @@ public class CosmeticsGui extends SilentScreen {
int height = addY * 2;
int tabId = 1;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Capes", selectedCategory == "capes"));
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Capes", false, selectedCategory == "capes" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Wings", selectedCategory == "wings"));
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Wings", false, selectedCategory == "wings" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Bandanas", selectedCategory == "bandanas"));
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Bandanas", false, selectedCategory == "bandanas" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Hats", selectedCategory == "hats"));
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Hats", false, selectedCategory == "hats" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Shields", selectedCategory == "shields"));
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Shields", false, selectedCategory == "shields" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Icons", selectedCategory == "icons"));
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Icons", false, selectedCategory == "icons" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
tabId++;
this.buttonList.add(new Button(tabId, x + 5, (y + height) - 26, 75, 20, "Store"));
@ -97,43 +97,70 @@ public class CosmeticsGui extends SilentScreen {
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button instanceof TabButton) {
TabButton tab = (TabButton) button;
switch (tab.id) {
if(button instanceof Button) {
switch (button.id) {
case 1:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "capes";
rotate = 144;
break;
case 2:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "wings";
rotate = 144;
break;
case 3:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "bandanas";
rotate = 340;
break;
case 4:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "hats";
rotate = 340;
break;
case 5:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "shields";
rotate = 340;
break;
case 6:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = "icons";
break;
}
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof TabButton) {
TabButton tabB = (TabButton) oldButton;
tabB.selected = false;
}
});
this.silentInputs.get(0).setValue("");
tab.selected = true;
scrollY = 0;
}
@ -221,7 +248,7 @@ public class CosmeticsGui extends SilentScreen {
int modIndex = 1;
//Draw background
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
ArrayList<CosmeticItem> items = null;
ArrayList<Number> selected_item = new ArrayList<>();
@ -267,7 +294,7 @@ public class CosmeticsGui extends SilentScreen {
GL11.glScissor(x * s, translatedY * s, width * s, (height - 25) * s);
if(items != null) {
for(CosmeticItem m : items) {
RoundedUtils.drawRoundedOutline(x + 100, y + modOffsetY + scrollAnimation.getValue(), x + 100 + 135, y + modOffsetY + scrollAnimation.getValue() + 28, 10, 2, selected_item.contains(m.getId()) ? new Color(32, 252, 3).getRGB() : new Color(252, 3, 3).getRGB());
RenderUtil.drawRoundedOutline(x + 100, y + modOffsetY + scrollAnimation.getValue(), 135, 28, 10, 2, selected_item.contains(m.getId()) ? new Color(32, 252, 3).getRGB() : new Color(252, 3, 3).getRGB());
GL11.glDisable((int) 2929);
GL11.glEnable((int) 3042);
@ -310,9 +337,6 @@ public class CosmeticsGui extends SilentScreen {
super.drawScreen(mouseX, mouseY, partialTicks);
RenderUtil.drawRoundedOutline(x + 5, (y + height) - 26, x + 5 + 75, ((y + height) - 26) + 20, 5, 2, -1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Client.getInstance().getSilentFontRenderer().drawCenteredString("Store", x + 5 + (75 / 2), ((y + height) - 20) - 3, 14, SilentFontRenderer.FontType.TITLE);
if(mc.thePlayer == null && can_show && selectedCategory != "icons") {
Client.getInstance().getSilentFontRenderer().drawString("Preview not available", x + 100 + 160, y + 100 - 3, 14, SilentFontRenderer.FontType.TITLE);
}

View File

@ -1,28 +1,13 @@
package net.silentclient.client.gui.clickgui;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.regex.Pattern;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import net.silentclient.client.Client;
import net.silentclient.client.config.AddConfigModal;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.animation.normal.Animation;
import net.silentclient.client.gui.animation.normal.Direction;
@ -38,13 +23,26 @@ import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.premium.PremiumGui;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.Sounds;
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.regex.Pattern;
public class ClickGUI extends SilentScreen {
private ModCategory selectedCategory;
@ -89,7 +87,7 @@ public class ClickGUI extends SilentScreen {
String formattedName = c.toString();
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 20, formattedName, selectedCategory == c));
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 20, formattedName, false, selectedCategory == c ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=25;
tabId++;
@ -113,7 +111,7 @@ public class ClickGUI extends SilentScreen {
//Draw background
GlStateManager.pushMatrix();
GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) introAnimation.getValue());
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString(selectedCategory.toString(), x + 100, (int) (y + 5), 14, SilentFontRenderer.FontType.TITLE);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
@ -131,8 +129,8 @@ public class ClickGUI extends SilentScreen {
float switchY = y + modOffsetY - scrollAnimation.getValue() + 55;
boolean switchHovered = selectedCategory.equals(ModCategory.MODS) && Switch.isHovered(mouseX, mouseY, switchX, switchY) && !headerHovered;
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70) && !headerHovered && !switchHovered && (Client.getInstance().getSettingsManager().getSettingByMod(m).size() != 0 || m.getName() == "Auto Text");
RoundedUtils.drawRoundedOutline(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), modOffsetX + 65, y + modOffsetY - scrollAnimation.getValue() + 70, 5, 2, new Color(255, 255, 255, 127).getRGB());
RoundedUtils.drawRoundedRect(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), modOffsetX + 65, y + modOffsetY - scrollAnimation.getValue() + 70, 5, new Color(255, 255, 255, isHovered ? 30 : 0).getRGB());
RenderUtil.drawRoundedOutline(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70, 3, 1, Theme.borderColor().getRGB());
RenderUtil.drawRoundedRect(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70, 3, new Color(255, 255, 255, isHovered ? 30 : 0).getRGB());
GL11.glColor4f(1, 1, 1, 1);
Client.getInstance().getSilentFontRenderer().drawString(m.getName(), modOffsetX + ((65 / 2) - ((Client.getInstance().getSilentFontRenderer().getStringWidth(m.getName(), 8, FontType.HEADER)) / 2)), y + modOffsetY - scrollAnimation.getValue() + 4, 8, FontType.HEADER);
if(m.getIcon() != null) {
@ -149,7 +147,7 @@ public class ClickGUI extends SilentScreen {
}
float badgeX = modOffsetX + ((65 / 2) - 15);
float badgeY = y + modOffsetY - scrollAnimation.getValue() + 13;
RenderUtil.drawRoundedRect(badgeX, badgeY, badgeX + 30, badgeY + 8, 8, Color.RED.getRGB());
RenderUtil.drawRoundedRect(badgeX, badgeY, 30, 8, 8, Color.RED.getRGB());
Client.getInstance().getSilentFontRenderer().drawString(status, badgeX + (status.equals("UPDATED") ? 3 : 9), badgeY + 1, 6, SilentFontRenderer.FontType.HEADER);
}
@ -159,21 +157,21 @@ public class ClickGUI extends SilentScreen {
column = column == 4 ? 1 : column + 1;
}
} else if(selectedCategory == ModCategory.CONFIGS) {
RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, -1);
RenderUtil.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28, 10, 2, -1);
Client.getInstance().getSilentFontRenderer().drawString("New Config", x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE);
modOffsetY+=column == 1 ? 0 : 35;
this.scrollHeight += column == 2 ? 28 : 0;
column = column == 1 ? 2 : 1;
RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, -1);
RenderUtil.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28, 10, 2, -1);
Client.getInstance().getSilentFontRenderer().drawString("Open Folder", x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE);
modOffsetY+=column == 1 ? 0 : 35;
this.scrollHeight += column == 2 ? 28 : 0;
column = column == 1 ? 2 : 1;
RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, new Color(32, 252, 3).getRGB());
RenderUtil.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28, 10, 2, new Color(32, 252, 3).getRGB());
RenderUtil.drawImage(new ResourceLocation("silentclient/transparent.png"), x + 90 + (column == 1 ? 0 : 130) + (column == 1 ? 125 : 135), y + modOffsetY + 7 - scrollAnimation.getValue(), 15, 15, false);
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawString(Client.getInstance().configManager.configFile.getName().replace(".txt", ""), x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE, 45);
@ -185,7 +183,7 @@ public class ClickGUI extends SilentScreen {
if(config.equals(".config-settings.txt") || config.equals(".DS_Store") || Client.getInstance().configManager.configFile.getName().equals(config)) {
continue;
}
RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, new Color(252, 3, 3).getRGB());
RenderUtil.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28, 10, 2, new Color(252, 3, 3).getRGB());
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/trash-icon.png"), x + 90 + (column == 1 ? 0 : 130) + (column == 1 ? 125 : 135), y + modOffsetY + 7 - scrollAnimation.getValue(), 15, 15, false);
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawString(config.replace(".txt", ""), x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE, 45);
@ -262,32 +260,48 @@ public class ClickGUI extends SilentScreen {
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(button instanceof TabButton) {
TabButton tab = (TabButton) button;
switch(tab.id) {
scrollY = 0;
if(button instanceof Button) {
switch(button.id) {
case 1:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = ModCategory.MODS;
break;
case 2:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = ModCategory.SETTINGS;
break;
case 3:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = ModCategory.CONFIGS;
break;
case 4:
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
selectedCategory = ModCategory.PLUS;
break;
}
scrollY = 0;
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof TabButton) {
TabButton tabB = (TabButton) oldButton;
tabB.selected = false;
}
});
tab.selected = true;
Client.getInstance().configManager.save();
}
Client.getInstance().configManager.save();
if(button.id == 5) {
mc.displayGuiScreen(new HUDConfigScreen(this));

View File

@ -1,37 +1,32 @@
package net.silentclient.client.gui.clickgui;
import java.awt.Color;
import java.io.IOException;
import java.util.ArrayList;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.MathHelper;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.Slider;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.animation.normal.Direction;
import net.silentclient.client.gui.clickgui.utils.GlUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.Slider;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.Sounds;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
import java.util.ArrayList;
public class GuiColorPicker extends GuiScreen {
private final Mod mod;
@ -100,7 +95,7 @@ public class GuiColorPicker extends GuiScreen {
int height = addY * 2;
GlStateManager.pushMatrix();
GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue());
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
GL11.glPushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

View File

@ -1,14 +1,5 @@
package net.silentclient.client.gui.clickgui;
import java.io.IOException;
import java.net.URI;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
@ -16,33 +7,31 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.animation.normal.Direction;
import net.silentclient.client.gui.clickgui.utils.GlUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils.Scroll;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.ColorPicker;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.elements.Select;
import net.silentclient.client.gui.elements.Slider;
import net.silentclient.client.gui.elements.StaticButton;
import net.silentclient.client.gui.elements.Switch;
import net.silentclient.client.gui.elements.*;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.mods.render.CrosshairMod;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.mods.world.TimeChangerMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.Sounds;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.io.IOException;
import java.net.URI;
public class ModSettings extends SilentScreen {
private final Mod mod;
@ -122,7 +111,7 @@ public class ModSettings extends SilentScreen {
GlStateManager.pushMatrix();
GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue());
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
GL11.glPushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

View File

@ -1,162 +0,0 @@
package net.silentclient.client.gui.clickgui;
import java.awt.Color;
import java.io.IOException;
import java.util.ArrayList;
import net.minecraft.client.gui.GuiButton;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.Sounds;
public class PlusColorPicker extends GuiScreen {
private final GuiScreen parentScreen;
private ArrayList<Color> colors = new ArrayList<Color>();
public PlusColorPicker(GuiScreen parent) {
this.parentScreen = parent;
}
@Override
public void initGui() {
colors.clear();
colors.add(new Color(255, 255, 255));
colors.add(new Color(156, 157, 151));
colors.add(new Color(71,79,82));
colors.add(new Color(0, 0, 0));
colors.add(new Color(255,216,61));
colors.add(new Color(249,128,29));
colors.add(new Color(176,46,38));
colors.add(new Color(130,84,50));
colors.add(new Color(128,199,31));
colors.add(new Color(58,179,218));
colors.add(new Color(22,156,157));
colors.add(new Color(60,68,169));
colors.add(new Color(243,140,170));
colors.add(new Color(198,79,189));
colors.add(new Color(137,50,183));
MenuBlurUtils.loadBlur();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int height = addY * 2;
this.buttonList.add(new Button(1, x + 5, y + 42, 75, 20, "< Back"));
this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD"));
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
super.onGuiClosed();
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button.id == 1) {
mc.displayGuiScreen(parentScreen);
}
if(button.id == 2) {
mc.displayGuiScreen(new HUDConfigScreen(this));
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int height = addY * 2;
RoundedUtils.drawRoundedRect(x + 90, y, x + 90 + width - 90, y + height, 15, Theme.backgroundColor().getRGB());
RoundedUtils.drawRoundedRect(x, y, x + 85, y + height, 15, Theme.backgroundColor().getRGB());
GL11.glPushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int settingY = y + 30;
int colorIndex = 0;
int spacing = 100;
for(Color color : colors) {
RenderUtils.drawRect(x + spacing, settingY - 1, 22, 22, new Color(0, 0, 0).getRGB());
RenderUtils.drawRect(x + spacing + 1, settingY - 1 + 1, 20, 20, color.getRGB());
spacing += 25;
colorIndex += 1;
if(colorIndex == 5 || colorIndex == 10) {
spacing = 100;
settingY += 30;
}
}
GL11.glPopMatrix();
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo_small.png"), x + (85 / 3), y + 5, 30, 30);
Client.getInstance().getSilentFontRenderer().drawString("Choose a color", x + 100, y + 10 - 3, 15, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
// TODO Auto-generated method stub
super.mouseClicked(mouseX, mouseY, mouseButton);
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int settingY = y + 30;
int colorIndex = 0;
int spacing = 100;
for(Color color : colors) {
if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22) && mouseButton == 0) {
Sounds.playButtonSound();
Client.getInstance().getAccount().setPlusIconColor(color.getRGB());
mc.displayGuiScreen(parentScreen);
}
spacing += 25;
colorIndex += 1;
if(colorIndex == 5 || colorIndex == 10) {
spacing = 100;
settingY += 30;
}
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_ESCAPE) {
Sounds.playButtonSound();
mc.displayGuiScreen(parentScreen);
}
}
}

View File

@ -1,79 +0,0 @@
package net.silentclient.client.gui.clickgui;
import java.awt.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SoundHandler;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.silentclient.client.Client;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.TimerUtils;
public class TabButton extends GuiButton {
private int animatedOpcaity = 0;
private TimerUtils animateTimer = new TimerUtils();
public boolean selected = false;
private int fontHeight = 14;
public TabButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean selected) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
this.selected = selected;
// TODO Auto-generated constructor stub
}
public TabButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, int fontHeight, boolean selected) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
this.selected = selected;
this.fontHeight = fontHeight;
// TODO Auto-generated constructor stub
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
if (this.visible)
{
GlStateManager.disableBlend();
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
if (!this.enabled)
{
new Color(255, 255, 255, 50).getRGB();
}
ColorUtils.setColor(this.enabled ? this.selected ? new Color(255,255,255, 255).getRGB() : new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, this.enabled ? this.selected ? new Color(255,255,255, 255).getRGB() : new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB());
ColorUtils.setColor(this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB());
this.mouseDragged(mc, mouseX, mouseY);
if (this.hovered && this.enabled) {
if (this.animatedOpcaity < 75 && animateTimer.delay(30)) {
this.animatedOpcaity += 15;
animateTimer.reset();
}
} else {
if (this.animatedOpcaity != 0 && animateTimer.delay(30)) {
this.animatedOpcaity -= 15;
animateTimer.reset();
}
}
ColorUtils.setColor(this.selected ? new Color(0, 0, 0).getRGB() : new Color(255, 255, 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - fontHeight) / 2, fontHeight, SilentFontRenderer.FontType.TITLE, width - (fontHeight / 2));
} else {
this.animatedOpcaity = 0;
}
}
@Override
public void playPressSound(SoundHandler soundHandlerIn) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Silent Button Sounds").getValBoolean()) {
return;
}
super.playPressSound(soundHandlerIn);
}
}

View File

@ -10,6 +10,8 @@ import net.silentclient.client.Client;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.IButtonTheme;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.TimerUtils;
@ -18,18 +20,29 @@ public class Button extends GuiButton
private int animatedOpcaity = 0;
private boolean escMenu = false;
private int fontSize;
private TimerUtils animateTimer = new TimerUtils();
public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean escMenu) {
private IButtonTheme theme;
public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, int fontSize, boolean escMenu, IButtonTheme theme) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
this.escMenu = escMenu;
// TODO Auto-generated constructor stub
this.theme = theme;
this.fontSize = fontSize;
}
public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
// TODO Auto-generated constructor stub
public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean escMenu, IButtonTheme theme) {
this(buttonId, x, y, widthIn, heightIn, buttonText, 14, escMenu, theme);
}
public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean escMenu) {
this(buttonId, x, y, widthIn, heightIn, buttonText, escMenu, new DefaultButtonTheme());
}
public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) {
this(buttonId, x, y, widthIn, heightIn, buttonText, false);
}
public Button(int buttonId, int x, int y, String buttonText)
@ -39,8 +52,7 @@ public class Button extends GuiButton
public Button(int buttonId, int x, int y, String buttonText, boolean escMenu)
{
this(buttonId, x, y, 200, 20, buttonText);
this.escMenu = escMenu;
this(buttonId, x, y, 200, 20, buttonText, escMenu);
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
@ -53,14 +65,12 @@ public class Button extends GuiButton
{
GlStateManager.disableBlend();
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
if (!this.enabled)
{
new Color(255, 255, 255, 50).getRGB();
}
ColorUtils.setColor(this.enabled ? new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, this.enabled ? new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB());
ColorUtils.setColor(this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB());
ColorUtils.setColor(theme.getBackgroundColor().getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, width, height, (float)3, theme.getBackgroundColor().getRGB());
ColorUtils.setColor(theme.getHoveredBackgroundColor(this.enabled ? animatedOpcaity : 0).getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, width, height, (float)3, theme.getHoveredBackgroundColor(this.enabled ? animatedOpcaity : 0).getRGB());
ColorUtils.setColor(this.enabled ? new Color(214, 213, 210, 255).getRGB() : new Color(255,255,255,50).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, width, height, 3, 1, theme.getBorderColor().getRGB());
this.mouseDragged(mc, mouseX, mouseY);
if (this.hovered && this.enabled) {
@ -74,12 +84,17 @@ public class Button extends GuiButton
animateTimer.reset();
}
}
Client.getInstance().getSilentFontRenderer().drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 14) / 2, 14, SilentFontRenderer.FontType.TITLE, width - 7);
this.drawButtonContent();
} else {
this.animatedOpcaity = 0;
}
}
protected void drawButtonContent() {
ColorUtils.setColor(theme.getTextColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - fontSize) / 2, fontSize, SilentFontRenderer.FontType.TITLE, width - (fontSize / 2));
}
@Override
public void playPressSound(SoundHandler soundHandlerIn) {
@ -88,5 +103,12 @@ public class Button extends GuiButton
}
super.playPressSound(soundHandlerIn);
}
public void setTheme(IButtonTheme theme) {
this.theme = theme;
}
public IButtonTheme getTheme() {
return theme;
}
}

View File

@ -3,17 +3,23 @@ package net.silentclient.client.gui.elements;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.theme.checkbox.DefaultCheckboxTheme;
import net.silentclient.client.gui.theme.checkbox.ICheckboxTheme;
import net.silentclient.client.gui.util.RenderUtil;
import java.awt.*;
public class Checkbox {
public static void render(int mouseX, int mouseY, int x, int y, String name, boolean selected) {
render(mouseX, mouseY, x, y, name, selected, new DefaultCheckboxTheme());
}
public static void render(int mouseX, int mouseY, int x, int y, String name, boolean selected, ICheckboxTheme theme) {
boolean hovered = Checkbox.isHovered(mouseX, mouseY, x, y);
Color checkColor = selected ? Color.green : new Color(255, 255, 255);
RenderUtil.drawRoundedOutline(x, y, x + 9, y + 9, 9, 2, new Color(checkColor.getRed(), checkColor.getGreen(), checkColor.getBlue(), hovered ? 127 : 255).getRGB());
Color checkColor = selected ? theme.getSelectedColor() : theme.getColor();
RenderUtil.drawRoundedOutline(x, y, 9, 9, 9, 2, new Color(checkColor.getRed(), checkColor.getGreen(), checkColor.getBlue(), hovered ? 127 : 255).getRGB());
if(selected) {
RenderUtil.drawRoundedRect(x + (9 / 2 - 5 / 2), y + (9 / 2 - 5 / 2), x + (9 / 2 - 5 / 2) + 5, y + (9 / 2 - 5 / 2) + 5, 5, checkColor.getRGB());
RenderUtil.drawRoundedRect(x + (9 / 2 - 5 / 2), y + (9 / 2 - 5 / 2), 5, 5, 5, checkColor.getRGB());
}
Client.getInstance().getSilentFontRenderer().drawString(name, x + 12, y + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE);
}

View File

@ -10,8 +10,8 @@ import java.awt.*;
public class ColorPicker {
public static void render(int x, int y, int width, String name, int color) {
Client.getInstance().getSilentFontRenderer().drawString(name, x + 100, y - 2, 12, SilentFontRenderer.FontType.TITLE);
RenderUtil.drawRoundedRect(x + width - 20, y + 1, x + width - 20 + 15, y + 9, 5, color);
RenderUtil.drawRoundedOutline(x + width - 20, y + 1, x + width - 20 + 15, y + 9, 5, 2, new Color(255, 255, 255).getRGB());
RenderUtil.drawRoundedRect(x + width - 20, y + 1, 15, 9, 5, color);
RenderUtil.drawRoundedOutline(x + width - 20, y + 1, 15, 8, 5, 2, new Color(255, 255, 255).getRGB());
}
public static boolean isHovered(int mouseX, int mouseY, int x, int y, int width) {

View File

@ -12,15 +12,13 @@ import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.TimerUtils;
public class IconButton extends GuiButton
public class IconButton extends Button
{
private int animatedOpcaity = 0;
private ResourceLocation icon;
private int iconWidth;
private int iconHeight;
private TimerUtils animateTimer = new TimerUtils();
public IconButton(int buttonId, int x, int y, int widthIn, int heightIn, int iconWidth, int iconHeight, ResourceLocation icon) {
super(buttonId, x, y, widthIn, heightIn, "");
this.icon = icon;
@ -33,41 +31,8 @@ public class IconButton extends GuiButton
this(buttonId, x, y, 20, 20, 12, 12, icon);
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
if (this.visible)
{
GlStateManager.disableBlend();
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, new Color(255,255,255,animatedOpcaity).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, new Color(255,255,255,255).getRGB());
this.mouseDragged(mc, mouseX, mouseY);
if (!this.enabled)
{
}
if (this.hovered && this.enabled) {
if (this.animatedOpcaity < 75 && animateTimer.delay(30)) {
this.animatedOpcaity += 15;
animateTimer.reset();
}
} else {
if (this.animatedOpcaity != 0 && animateTimer.delay(30)) {
this.animatedOpcaity -= 15;
animateTimer.reset();
}
}
RenderUtil.drawImage(icon, this.xPosition + ((this.width / 2) - (this.iconWidth / 2)), this.yPosition + ((this.height / 2) - (this.iconHeight / 2)), this.iconWidth, this.iconHeight, false);
}
}
@Override
public void playPressSound(SoundHandler soundHandlerIn) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Silent Button Sounds").getValBoolean()) {
return;
}
super.playPressSound(soundHandlerIn);
protected void drawButtonContent() {
RenderUtil.drawImage(icon, this.xPosition + ((this.width / 2) - (this.iconWidth / 2)), this.yPosition + ((this.height / 2) - (this.iconHeight / 2)), this.iconWidth, this.iconHeight, false);
}
}

View File

@ -6,6 +6,8 @@ import net.minecraft.util.EnumChatFormatting;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.theme.input.DefaultInputTheme;
import net.silentclient.client.gui.theme.input.IInputTheme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.NotificationUtils;
@ -61,33 +63,37 @@ public class Input {
}
public void render(int mouseX, int mouseY, int x, int y, int width, boolean small) {
int borderColor = new Color(255, 255, 255, 41).getRGB();
this.render(mouseX, mouseY, x, y, width, small, new DefaultInputTheme());
}
public void render(int mouseX, int mouseY, int x, int y, int width, boolean small, IInputTheme theme) {
int borderColor = theme.getBorderColor().getRGB();
if(MouseUtils.isInside(mouseX, mouseY, x, y, width, 20)) {
borderColor = new Color(255, 255, 255, 61).getRGB();
borderColor = theme.getHoveredBorderColor().getRGB();
this.hovered = true;
} else {
this.hovered = false;
}
if(isFocused) {
borderColor = new Color(255, 255, 255, 255).getRGB();
borderColor = theme.getFocusedBorderColor().getRGB();
}
RenderUtil.drawRoundedOutline(x, y, x + width, y + (small ? 15 : 20), 5, 3, borderColor);
RenderUtil.drawRoundedOutline(x, y, width, (small ? 15 : 20), 3, isFocused ? 2 : 1, borderColor);
String renderText = name;
ColorUtils.setColor(new Color(255, 255, 255, 41).getRGB());
ColorUtils.setColor(theme.getBorderColor().getRGB());
if(value.length() != 0) {
renderText = value;
ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB());
ColorUtils.setColor(theme.getFocusedBorderColor().getRGB());
}
if(keyValue) {
if(key != -1) {
renderText = Keyboard.getKeyName(key);
ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB());
ColorUtils.setColor(theme.getFocusedBorderColor().getRGB());
}
if(isFocused) {
renderText = "...";
ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB());
ColorUtils.setColor(theme.getFocusedBorderColor().getRGB());
}
}
Client.getInstance().getSilentFontRenderer().drawString(EnumChatFormatting.getTextWithoutFormattingCodes(renderText), x + 2, y + (small ? 1 : 3), small ? 12 : 14, SilentFontRenderer.FontType.TITLE);

View File

@ -1,12 +1,12 @@
package net.silentclient.client.gui.elements;
import java.awt.Color;
import net.minecraft.client.renderer.GlStateManager;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.IButtonTheme;
import net.silentclient.client.utils.ColorUtils;
public class StaticButton {
@ -14,13 +14,21 @@ public class StaticButton {
{
StaticButton.render(xPosition, yPosition, width, height, displayString, false);
}
public static void render(int xPosition, int yPosition, int width, int height, String displayString, boolean bold)
{
StaticButton.render(xPosition, yPosition, width, height, displayString, bold, new DefaultButtonTheme());
}
public static void render(int xPosition, int yPosition, int width, int height, String displayString, boolean bold)
public static void render(int xPosition, int yPosition, int width, int height, String displayString, boolean bold, IButtonTheme theme)
{
GlStateManager.disableBlend();
ColorUtils.setColor(new Color(255,255,255,255).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, new Color(255,255,255,255).getRGB());
ColorUtils.setColor(theme.getBackgroundColor().getRGB());
RenderUtil.drawRoundedRect(xPosition, yPosition, width, height, 3, theme.getBackgroundColor().getRGB());
ColorUtils.setColor(theme.getBorderColor().getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, width, height, 3, 1, theme.getBorderColor().getRGB());
ColorUtils.setColor(theme.getTextColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString(displayString, xPosition + width / 2, yPosition + (height - (bold ? 8 : 10)) / 2, bold ? 8 : 10, bold ? SilentFontRenderer.FontType.HEADER : SilentFontRenderer.FontType.TITLE, width - (bold ? 8 : 10));
}

View File

@ -1,16 +1,22 @@
package net.silentclient.client.gui.elements;
import java.awt.Color;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.gui.theme.switches.DefaultSwitchTheme;
import net.silentclient.client.gui.theme.switches.ISwitchSchema;
import net.silentclient.client.gui.util.RenderUtil;
public class Switch {
public static void render(int mouseX, int mouseY, float x, float y, SimpleAnimation animation, boolean checked, boolean disabled) {
RoundedUtils.drawRoundedRect(x, y, x + 15, y + 8, 8, disabled ? new Color(229, 62, 62).getRGB() : checked ? Color.GREEN.getRGB() : new Color(255, 255, 255, 61).getRGB());
RoundedUtils.drawRoundedOutline(x, y, x + 15, y + 8, 8, 2, new Color(255, 255, 255, isHovered(mouseX, mouseY, x, y) ? 127 : 0).getRGB());
RoundedUtils.drawRoundedRect(x + 0.5F + (animation.getValue()), y + 0.5F, x + 0.5F + (animation.getValue()) + 7, y + 0.5F + 7, 7, -1);
render(mouseX, mouseY, x, y, animation, checked, disabled, new DefaultSwitchTheme());
}
public static void render(int mouseX, int mouseY, float x, float y, SimpleAnimation animation, boolean checked, boolean disabled, ISwitchSchema theme) {
RenderUtil.drawRoundedRect(x, y, 15, 8, 8, disabled ? theme.getDisabledBackgroundColor().getRGB() : checked ? theme.getSelectedBackgroundColor().getRGB() : theme.getBackgroundColor().getRGB());
if(isHovered(mouseX, mouseY, x, y)) {
RenderUtil.drawRoundedOutline(x, y, 15, 8, 8, 2, theme.getBorderColor().getRGB());
}
RenderUtil.drawRoundedRect(x + 0.5F + (animation.getValue()), y + 0.5F, 7, 7, 7, theme.getCircleColor().getRGB());
animation.setAnimation(checked && !disabled ? 15 - 8 : 0, 20);
}

View File

@ -1,13 +1,5 @@
package net.silentclient.client.gui.friends;
import java.awt.Color;
import java.io.IOException;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
@ -15,17 +7,25 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.clickgui.TabButton;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.types.FriendsResponse;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
public class FriendsListOverlay extends GuiScreen {
private double scrollY;
@ -42,8 +42,8 @@ public class FriendsListOverlay extends GuiScreen {
MenuBlurUtils.loadBlur();
this.buttonList.add(new IconButton(1, 133, 6, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
this.buttonList.add(new TabButton(2, 3, 26, 70, 15, "Friends", 12, !showRequests));
this.buttonList.add(new TabButton(3, 76, 26, 70, 15, "Requests", 12, showRequests));
this.buttonList.add(new Button(2, 3, 26, 70, 15, "Friends", 12, false, !showRequests ? new SelectedButtonTheme() : new DefaultButtonTheme()));
this.buttonList.add(new Button(3, 76, 26, 70, 15, "Requests", 12, false, showRequests ? new SelectedButtonTheme() : new DefaultButtonTheme()));
this.buttonList.add(new IconButton(4, 116, 6, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/friends-add.png")));
}
@ -132,21 +132,25 @@ public class FriendsListOverlay extends GuiScreen {
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button instanceof TabButton) {
TabButton tab = (TabButton) button;
if(tab.id == 2) {
if(button instanceof Button) {
if(button.id == 2) {
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
showRequests = false;
} else {
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof Button) {
((Button) oldButton).setTheme(new DefaultButtonTheme());
}
});
((Button) button).setTheme(new SelectedButtonTheme());
showRequests = true;
}
scrollY = 0;
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof TabButton) {
TabButton tabB = (TabButton) oldButton;
tabB.selected = false;
}
});
tab.selected = true;
}
switch (button.id) {
case 1:

View File

@ -62,7 +62,7 @@ public class Notification {
animation.setDirection(Direction.BACKWARDS);
}
RenderUtil.drawRoundedRect((float) (sr.getScaledWidth() - offset), 4, ((float) (sr.getScaledWidth() - offset)) + (this.width - 5), 4 + 26, 3, new Color(19, 19, 19).getRGB());
RenderUtil.drawRoundedRect((float) (sr.getScaledWidth() - offset), 4, (this.width - 5), 26, 3, new Color(19, 19, 19).getRGB());
RenderUtil.drawImage(new ResourceLocation("silentclient/mods/notifications/"+ status.toLowerCase() + ".png"), (float) (sr.getScaledWidth() - offset) + 2, 4 + 2, 22, 22);
font.drawString(WordUtils.capitalize(status), (int) (sr.getScaledWidth() - offset + 28), 4 + 3, -1, false);

View File

@ -6,4 +6,8 @@ public class Theme {
public static Color backgroundColor() {
return new Color(0, 0, 0, 127);
}
public static Color borderColor() {
return new Color(214, 213, 210);
}
}

View File

@ -0,0 +1,26 @@
package net.silentclient.client.gui.theme.button;
import java.awt.*;
public class DefaultButtonTheme implements IButtonTheme {
@Override
public Color getBorderColor() {
return new Color(214, 213, 210);
}
@Override
public Color getBackgroundColor() {
return new Color(0, 0, 0, 40);
}
@Override
public Color getTextColor() {
return new Color(255, 255, 255);
}
@Override
public Color getHoveredBackgroundColor(int opacity) {
return new Color(255, 255, 255, opacity);
}
}

View File

@ -0,0 +1,10 @@
package net.silentclient.client.gui.theme.button;
import java.awt.*;
public interface IButtonTheme {
Color getBorderColor();
Color getBackgroundColor();
Color getTextColor();
Color getHoveredBackgroundColor(int opacity);
}

View File

@ -0,0 +1,25 @@
package net.silentclient.client.gui.theme.button;
import java.awt.*;
public class SelectedButtonTheme implements IButtonTheme {
@Override
public Color getBorderColor() {
return new Color(255, 255, 255);
}
@Override
public Color getBackgroundColor() {
return new Color(255, 255, 255);
}
@Override
public Color getTextColor() {
return new Color(0, 0, 0);
}
@Override
public Color getHoveredBackgroundColor(int opacity) {
return new Color(255, 255, 255, opacity);
}
}

View File

@ -1,7 +0,0 @@
package net.silentclient.client.gui.theme.buttonthemes;
import java.awt.*;
public interface IButtonSchema {
Color getBackgroundColor();
}

View File

@ -0,0 +1,15 @@
package net.silentclient.client.gui.theme.checkbox;
import java.awt.*;
public class DefaultCheckboxTheme implements ICheckboxTheme {
@Override
public Color getColor() {
return new Color(214, 213, 210);
}
@Override
public Color getSelectedColor() {
return new Color(165, 227, 177);
}
}

View File

@ -0,0 +1,8 @@
package net.silentclient.client.gui.theme.checkbox;
import java.awt.*;
public interface ICheckboxTheme {
Color getColor();
Color getSelectedColor();
}

View File

@ -0,0 +1,20 @@
package net.silentclient.client.gui.theme.input;
import java.awt.*;
public class DefaultInputTheme implements IInputTheme {
@Override
public Color getBorderColor() {
return new Color(214, 213, 210);
}
@Override
public Color getHoveredBorderColor() {
return new Color(230, 230, 230);
}
@Override
public Color getFocusedBorderColor() {
return new Color(255, 255, 255);
}
}

View File

@ -0,0 +1,9 @@
package net.silentclient.client.gui.theme.input;
import java.awt.*;
public interface IInputTheme {
Color getBorderColor();
Color getHoveredBorderColor();
Color getFocusedBorderColor();
}

View File

@ -0,0 +1,30 @@
package net.silentclient.client.gui.theme.switches;
import java.awt.*;
public class DefaultSwitchTheme implements ISwitchSchema {
@Override
public Color getSelectedBackgroundColor() {
return new Color(165, 227, 177);
}
@Override
public Color getDisabledBackgroundColor() {
return new Color(229, 62, 62);
}
@Override
public Color getBackgroundColor() {
return new Color(255, 255, 255, 61);
}
@Override
public Color getCircleColor() {
return new Color(255, 255, 255);
}
@Override
public Color getBorderColor() {
return new Color(214, 213, 210);
}
}

View File

@ -0,0 +1,11 @@
package net.silentclient.client.gui.theme.switches;
import java.awt.*;
public interface ISwitchSchema {
Color getSelectedBackgroundColor();
Color getDisabledBackgroundColor();
Color getBackgroundColor();
Color getCircleColor();
Color getBorderColor();
}

View File

@ -22,151 +22,9 @@ public class RenderUtil {
final static Minecraft mc = Minecraft.getMinecraft();
final static FontRenderer fr = mc.fontRendererObj;
public static void drawFilledWithGL(AxisAlignedBB box) {
final Tessellator tessellator = Tessellator.getInstance();
final WorldRenderer worldRenderer = tessellator.getWorldRenderer();
worldRenderer.begin(7, DefaultVertexFormats.POSITION);
worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
tessellator.draw();
worldRenderer.begin(7, DefaultVertexFormats.POSITION);
worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
tessellator.draw();
worldRenderer.begin(7, DefaultVertexFormats.POSITION);
worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
tessellator.draw();
worldRenderer.begin(7, DefaultVertexFormats.POSITION);
worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
tessellator.draw();
worldRenderer.begin(7, DefaultVertexFormats.POSITION);
worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
tessellator.draw();
worldRenderer.begin(7, DefaultVertexFormats.POSITION);
worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
tessellator.draw();
}
public static void enableGL2D() {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(true);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
}
public static void disableGL2D() {
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDisable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE);
}
/*
*
* NORMAL
*
*/
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius : round of edges;
* @param color : color;
*/
public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glEnable(GL_LINE_SMOOTH);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_POLYGON);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glBegin(GL_LINE_LOOP);
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_LINE_SMOOTH);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
x1 = x + x1;
y1 = y + y1;
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
@ -181,35 +39,37 @@ public class RenderUtil {
glBegin(GL_POLYGON);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glBegin(GL_LINE_LOOP);
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glEnable(GL_BLEND);
glPopAttrib();
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius : round of edges;
* @param lineWidth : width of outline line;
* @param color : color;
*/
public static void drawRoundedOutline(float x, float y, float x1, float y1, float radius,float lineWidth, int color) {
x1 = x + x1;
y1 = y + y1;
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
@ -242,104 +102,13 @@ public class RenderUtil {
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
/*
*
* SELECTED EDGES
*
*/
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius1 : round of left top edges;
* @param radius2 : round of right top edges;
* @param radius3 : round of left bottom edges;
* @param radius4 : round of right bottom edges;
* @param color : color;
*/
public static void drawSelectRoundedRect(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4, int color) {
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glBegin(9);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius1 : round of left top edges;
* @param radius2 : round of right top edges;
* @param radius3 : round of left bottom edges;
* @param radius4 : round of right bottom edges;
* @param lineWidth : width of outline line;
* @param color : color;
/*
*
* SELECTED EDGES
*
*/
public static void drawSelectRoundedOutline(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4,float lineWidth, int color) {
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glLineWidth(lineWidth);
glBegin(GL_LINE_LOOP);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
public static void setColor(int color) {
float a = (color >> 24 & 0xFF) / 255.0F;
float r = (color >> 16 & 0xFF) / 255.0F;
@ -347,136 +116,6 @@ public class RenderUtil {
float b = (color & 0xFF) / 255.0F;
GlStateManager.color(r, g, b, a);
}
/*
*
* GRADIENT
*
*/
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius : round of edges;
* @param color : color;
* @param color2 : color2;
* @param color3 : color3;
* @param color4 : color4;
*/
public static void drawRoundedGradientRectCorner(float x, float y, float x1, float y1, float radius, int color, int color2, int color3, int color4) {
setColor(-1);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glBegin(9);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
setColor(color2);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
setColor(color3);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
setColor(color4);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glShadeModel(GL_FLAT);
setColor(-1);
}
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param width : width of line;
* @param radius : round of edges;
* @param color : color;
* @param color2 : color2;
* @param color3 : color3;
* @param color4 : color4;
*/
public static void drawRoundedGradientOutlineCorner(float x, float y, float x1, float y1, float width, float radius, int color, int color2, int color3, int color4) {
setColor(-1);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glLineWidth(width);
glBegin(GL_LINE_LOOP);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
setColor(color2);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
setColor(color3);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
setColor(color4);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glLineWidth(1);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glShadeModel(GL_FLAT);
setColor(-1);
}
public static void drawImage(float x, float y, float width, float height) {
GL11.glPushMatrix();

View File

@ -1,402 +0,0 @@
package net.silentclient.client.gui.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import static org.lwjgl.opengl.GL11.*;
public class RoundedUtils {
final static Minecraft mc = Minecraft.getMinecraft();
final static FontRenderer fr = mc.fontRendererObj;
public static void enableGL2D() {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(true);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
}
public static void disableGL2D() {
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDisable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE);
}
/*
*
* NORMAL
*
*/
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius : round of edges;
* @param color : color;
*/
public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glEnable(GL_LINE_SMOOTH);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_POLYGON);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glBegin(GL_LINE_LOOP);
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_LINE_SMOOTH);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glEnable(GL_LINE_SMOOTH);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_POLYGON);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glScaled(2.0D, 2.0D, 2.0D);
glEnable(GL_BLEND);
glPopAttrib();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius : round of edges;
* @param lineWidth : width of outline line;
* @param color : color;
*/
public static void drawRoundedOutline(float x, float y, float x1, float y1, float radius,float lineWidth, int color) {
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glLineWidth(lineWidth);
glBegin(GL_LINE_LOOP);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
/*
*
* SELECTED EDGES
*
*/
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius1 : round of left top edges;
* @param radius2 : round of right top edges;
* @param radius3 : round of left bottom edges;
* @param radius4 : round of right bottom edges;
* @param color : color;
*/
public static void drawSelectRoundedRect(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4, int color) {
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glBegin(9);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius1 : round of left top edges;
* @param radius2 : round of right top edges;
* @param radius3 : round of left bottom edges;
* @param radius4 : round of right bottom edges;
* @param lineWidth : width of outline line;
* @param color : color;
*/
public static void drawSelectRoundedOutline(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4,float lineWidth, int color) {
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glLineWidth(lineWidth);
glBegin(GL_LINE_LOOP);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
public static void setColor(int color) {
float a = (color >> 24 & 0xFF) / 255.0F;
float r = (color >> 16 & 0xFF) / 255.0F;
float g = (color >> 8 & 0xFF) / 255.0F;
float b = (color & 0xFF) / 255.0F;
glColor4f(r, g, b, a);
}
/*
*
* GRADIENT
*
*/
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param radius : round of edges;
* @param color : color;
* @param color2 : color2;
* @param color3 : color3;
* @param color4 : color4;
*/
public static void drawRoundedGradientRectCorner(float x, float y, float x1, float y1, float radius, int color, int color2, int color3, int color4) {
setColor(-1);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glBegin(9);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
setColor(color2);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
setColor(color3);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
setColor(color4);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glShadeModel(GL_FLAT);
setColor(-1);
}
/**
* @param x : X pos
* @param y : Y pos
* @param x1 : X2 pos
* @param y1 : Y2 pos
* @param width : width of line;
* @param radius : round of edges;
* @param color : color;
* @param color2 : color2;
* @param color3 : color3;
* @param color4 : color4;
*/
public static void drawRoundedGradientOutlineCorner(float x, float y, float x1, float y1, float width, float radius, int color, int color2, int color3, int color4) {
setColor(-1);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
setColor(color);
glEnable(GL_LINE_SMOOTH);
glShadeModel(GL_SMOOTH);
glLineWidth(width);
glBegin(GL_LINE_LOOP);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
setColor(color2);
for (i = 90; i <= 180; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
setColor(color3);
for (i = 0; i <= 90; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
setColor(color4);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glLineWidth(1);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glScaled(2.0D, 2.0D, 2.0D);
glPopAttrib();
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glShadeModel(GL_FLAT);
setColor(-1);
}
}

View File

@ -162,8 +162,6 @@ public abstract class ModDraggable extends Mod implements IRenderer {
Client.getInstance().getSilentFontRenderer().drawString(debugX, debugY + 30, "dragging: " + this.isDragging(), 6, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(debugX, debugY + 36, "cursor: " + Client.getInstance().getMouseCursorHandler().getCurrentCursor(), 6, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(debugX, debugY + 42, "corner: " + (pos.getAbsoluteX() + (getCornerX(HUDConfigScreen.CornerScalingType.BOTTOM_RIGHT) * getScale())) + ", " + (pos.getAbsoluteY() + (getCornerY(HUDConfigScreen.CornerScalingType.BOTTOM_RIGHT) * getScale())), 6, SilentFontRenderer.FontType.TITLE);
GlStateManager.popMatrix();
}
ColorUtils.setColor(-1);
@ -185,7 +183,7 @@ public abstract class ModDraggable extends Mod implements IRenderer {
color = new Color(245, 188, 0).getRGB();
}
RenderUtil.drawRoundedRect(getCornerX(cornerType), getCornerY(cornerType), getCornerX(cornerType) + 3, getCornerY(cornerType) + 3, 3, color);
RenderUtil.drawRoundedRect(getCornerX(cornerType), getCornerY(cornerType), 3, 3, 3, color);
}
public int getCornerX(HUDConfigScreen.CornerScalingType cornerType) {

View File

@ -88,7 +88,7 @@ public class MouseStrokesMod extends ModDraggable {
pitchAnimation.setAnimation(lastY, 100);
ColorUtils.setColor(dotColor.getRGB());
RenderUtil.drawRoundedRect(0 + 23 + yawAnimation.getValue() + 8, 0 + 23 + pitchAnimation.getValue() + 8, 0 + 23 + yawAnimation.getValue() + 4 + 8, 0 + 23 + pitchAnimation.getValue() + 4 + 8, 4, dotColor.getRGB());
RenderUtil.drawRoundedRect(0 + 23 + yawAnimation.getValue() + 8, 0 + 23 + pitchAnimation.getValue() + 8, 4, 4, 4, dotColor.getRGB());
ColorUtils.setColor(-1);
GlStateManager.popMatrix();
return true;

View File

@ -163,8 +163,8 @@ public class CrosshairMod extends Mod {
int spacing = 0;
int crossY = y + 30;
String selected = Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset ID").getValString();
RenderUtil.drawRoundedRect(x + spacing, crossY - 1, x + spacing + 22, crossY - 1 + 22, 5, new Color(0, 0, 0).getRGB());
RenderUtil.drawRoundedOutline(x + spacing, crossY - 1, x + spacing + 22, crossY - 1 + 22, 5, 3, -1);
RenderUtil.drawRoundedRect(x + spacing, crossY - 1, 22, 22, 5, new Color(0, 0, 0).getRGB());
RenderUtil.drawRoundedOutline(x + spacing, crossY - 1, 22, 22, 5, 3, -1);
RenderUtil.waitDrawImage(new ResourceLocation("silentclient/mods/crosshair/crosshair" + selected + ".png"), x + spacing + ((22 / 2) - (15 / 2)), crossY - 1 + ((22 / 2) - (15 / 2)), 15, 15, false);
spacing += 25;
@ -176,7 +176,7 @@ public class CrosshairMod extends Mod {
RenderUtil.drawRoundedRect(x + spacing, crossY - 1, x + spacing + 22, crossY - 1 + 22, 5, new Color(0, 0, 0).getRGB());
if(MouseUtils.isInside(mouseX, mouseY, x + spacing, crossY - 1, 22, 22)) {
RenderUtil.drawRoundedOutline(x + spacing, crossY - 1, x + spacing + 22, crossY - 1 + 22, 5, 3, new Color(255, 255, 255, 127).getRGB());
RenderUtil.drawRoundedOutline(x + spacing, crossY - 1, 22, 22, 5, 3, new Color(255, 255, 255, 127).getRGB());
}
RenderUtil.waitDrawImage(new ResourceLocation("silentclient/mods/crosshair/crosshair" + presetID + ".png"), x + spacing + ((22 / 2) - (15 / 2)), crossY - 1 + ((22 / 2) - (15 / 2)), 15, 15, false);

View File

@ -1,14 +1,5 @@
package net.silentclient.client.premium;
import java.awt.Color;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@ -22,17 +13,21 @@ import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.ColorPicker;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.elements.StaticButton;
import net.silentclient.client.gui.elements.*;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.Sounds;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
public class PremiumGui {
public static void drawScreen(int x, int y, int width, int height, int mouseX, int mouseY, float partialTicks, Input input) {
@ -167,7 +162,7 @@ public class PremiumGui {
int height = addY * 2;
GlStateManager.pushMatrix();
GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue());
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
GL11.glPushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

View File

@ -1,8 +1,7 @@
package net.silentclient.client.utils;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.*;
import javax.imageio.ImageIO;
@ -11,6 +10,21 @@ import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation;
public class FileUtils {
public static String readInputStream(InputStream inputStream) {
StringBuilder stringBuilder = new StringBuilder();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = bufferedReader.readLine()) != null)
stringBuilder.append(line).append('\n');
} catch (Exception e) {
e.printStackTrace();
}
return stringBuilder.toString();
}
public static ResourceLocation fileToResourceLocation(File file) {
ResourceLocation location = null;
BufferedImage img = null;