Merge pull request #23 from Silent-Client/TEST2

Test2
This commit is contained in:
kirillsaint 2023-08-15 02:13:48 +06:00 committed by GitHub
commit 344c702cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -176,7 +176,7 @@ public class ModSettings extends SilentScreen {
if (Slider.isDrag(mouseX, mouseY, x, settingY - 1, width) && (System.currentTimeMillis() - initTime) > 500) { if (Slider.isDrag(mouseX, mouseY, x, settingY - 1, width) && (System.currentTimeMillis() - initTime) > 500) {
double diff = setting.getMax() - setting.getMin(); double diff = setting.getMax() - setting.getMin();
double mouse = MathHelper.clamp_double((mouseX - Slider.getLeft(x, width)) / 100D, 0, 1); double mouse = MathHelper.clamp_double((mouseX - Slider.getLeft(x, width)) / 90D, 0, 1);
double newVal = setting.getMin() + mouse * diff; double newVal = setting.getMin() + mouse * diff;
if(newVal != setting.getValDouble()) { if(newVal != setting.getValDouble()) {
setting.setValDouble(newVal); setting.setValDouble(newVal);

View File

@ -13,9 +13,9 @@ public class RegularSlider {
public static void render(float x, float y, int width, String name, double max, double value) { public static void render(float x, float y, int width, String name, double max, double value) {
Client.getInstance().getSilentFontRenderer().drawString(name, x, y, 12, SilentFontRenderer.FontType.TITLE); Client.getInstance().getSilentFontRenderer().drawString(name, x, y, 12, SilentFontRenderer.FontType.TITLE);
RenderUtil.drawRoundedRect(x, y + 15, 144, 9, 3, Color.black.getRGB()); RenderUtil.drawRoundedRect(x, y + 15, width, 9, 3, Color.black.getRGB());
if(value != 0) { if(value != 0) {
RenderUtil.drawRoundedRect(x, y + 15, 144F * (float) (value / max), 9, 3, -1); RenderUtil.drawRoundedRect(x, y + 15, width * (float) (value / max), 9, 3, -1);
} }
float textLeft = x + width - Client.getInstance().getSilentFontRenderer().getStringWidth(new DecimalFormat("0.00").format(value), 12, SilentFontRenderer.FontType.TITLE); float textLeft = x + width - Client.getInstance().getSilentFontRenderer().getStringWidth(new DecimalFormat("0.00").format(value), 12, SilentFontRenderer.FontType.TITLE);
@ -23,6 +23,6 @@ public class RegularSlider {
} }
public static boolean isDrag(int mouseX, int mouseY, float x, float y, int width) { public static boolean isDrag(int mouseX, int mouseY, float x, float y, int width) {
return MouseUtils.isInside(mouseX, mouseY, x, y + 15, 144, 9) && Mouse.isButtonDown(0); return MouseUtils.isInside(mouseX, mouseY, x, y + 15, width, 9) && Mouse.isButtonDown(0);
} }
} }