mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 09:31:32 +01:00
commit
344c702cb1
@ -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);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user