Added a setFPS() method to GuiVideoFramerateSlider to programmatically change the FPS value
This commit is contained in:
@@ -12,9 +12,8 @@ public class GuiVideoFramerateSlider extends GuiAdvancedButton {
|
||||
private float sliderValue;
|
||||
public GuiVideoFramerateSlider(int xPos, int yPos, int initialFramerate, String displayKey) {
|
||||
super(xPos, yPos, 150, 20, "", null, null);
|
||||
this.sliderValue = normalizeValue(initialFramerate);
|
||||
this.displayString = displayKey + ": " + translate(initialFramerate);
|
||||
this.displayKey = displayKey;
|
||||
setFPS(initialFramerate);
|
||||
}
|
||||
|
||||
private String translate(int value) {
|
||||
@@ -47,6 +46,11 @@ public class GuiVideoFramerateSlider extends GuiAdvancedButton {
|
||||
return denormalizeValue(sliderValue);
|
||||
}
|
||||
|
||||
public void setFPS(int fps) {
|
||||
this.sliderValue = normalizeValue(fps);
|
||||
this.displayString = displayKey + ": " + translate(fps);
|
||||
}
|
||||
|
||||
private float normalizeValue(int val) {
|
||||
return (val - 10) / 110f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user