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;
|
private float sliderValue;
|
||||||
public GuiVideoFramerateSlider(int xPos, int yPos, int initialFramerate, String displayKey) {
|
public GuiVideoFramerateSlider(int xPos, int yPos, int initialFramerate, String displayKey) {
|
||||||
super(xPos, yPos, 150, 20, "", null, null);
|
super(xPos, yPos, 150, 20, "", null, null);
|
||||||
this.sliderValue = normalizeValue(initialFramerate);
|
|
||||||
this.displayString = displayKey + ": " + translate(initialFramerate);
|
|
||||||
this.displayKey = displayKey;
|
this.displayKey = displayKey;
|
||||||
|
setFPS(initialFramerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String translate(int value) {
|
private String translate(int value) {
|
||||||
@@ -47,6 +46,11 @@ public class GuiVideoFramerateSlider extends GuiAdvancedButton {
|
|||||||
return denormalizeValue(sliderValue);
|
return denormalizeValue(sliderValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFPS(int fps) {
|
||||||
|
this.sliderValue = normalizeValue(fps);
|
||||||
|
this.displayString = displayKey + ": " + translate(fps);
|
||||||
|
}
|
||||||
|
|
||||||
private float normalizeValue(int val) {
|
private float normalizeValue(int val) {
|
||||||
return (val - 10) / 110f;
|
return (val - 10) / 110f;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user