fix crash & set slider offset
This commit is contained in:
parent
a255143e01
commit
38e2fd5651
|
@ -233,25 +233,28 @@ public class ClickGUI extends GuiScreen {
|
|||
fr.drawStringWithShadow(s.name, this.x + 24, height +43 + var, -1);
|
||||
var += 3;
|
||||
}
|
||||
|
||||
NumberSetting ss = ((NumberSetting)s);
|
||||
|
||||
if(s instanceof NumberSetting) {
|
||||
NumberSetting ss = ((NumberSetting)s);
|
||||
fr.drawStringWithShadow(s.name + ": sof " + sliderOffset + ", val: " + ((NumberSetting)s).getValue(), this.x+24, height+41+var, -1);
|
||||
drawRect(width-150, height+43+var, width-45, height+47+var, -1);
|
||||
RenderUtils.drawRoundedRect(width-150+sliderOffset, height+41+var, width-141+sliderOffset, height+50+var, 4, Color.RED.getRGB());
|
||||
|
||||
if(dragging) {
|
||||
sliderOffset = mouseX-(width-150);
|
||||
sliderOffset = mouseX-(width-150);
|
||||
ss.setValue(sliderOffset*(ss.max/100));
|
||||
}
|
||||
|
||||
if(!dragging) {
|
||||
sliderOffset = (int) ((ss.getValue() * 100)/ss.max);
|
||||
}
|
||||
|
||||
if(sliderOffset < 0) {
|
||||
dragging = false;
|
||||
sliderOffset = 0;
|
||||
}
|
||||
|
||||
if(width-141+sliderOffset > width-45) {
|
||||
if(width-141+sliderOffset > width-50) {
|
||||
dragging = false;
|
||||
sliderOffset = 100;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user