Make the Quality Option not confusing
This commit is contained in:
@@ -226,7 +226,15 @@ class Options
|
||||
|
||||
public static function applySettings() {
|
||||
applyKeybinds();
|
||||
applyQuality();
|
||||
|
||||
FlxG.sound.defaultMusicGroup.volume = volumeMusic;
|
||||
FlxG.autoPause = autoPause;
|
||||
if (FlxG.updateFramerate < framerate) FlxG.drawFramerate = FlxG.updateFramerate = framerate;
|
||||
else FlxG.updateFramerate = FlxG.drawFramerate = framerate;
|
||||
}
|
||||
|
||||
public static function applyQuality() {
|
||||
switch (quality) {
|
||||
case 0:
|
||||
antialiasing = false;
|
||||
@@ -238,11 +246,7 @@ class Options
|
||||
gameplayShaders = true;
|
||||
}
|
||||
|
||||
FlxG.sound.defaultMusicGroup.volume = volumeMusic;
|
||||
FlxG.game.stage.quality = (FlxG.enableAntialiasing = antialiasing) ? BEST : LOW;
|
||||
FlxG.autoPause = autoPause;
|
||||
if (FlxG.updateFramerate < framerate) FlxG.drawFramerate = FlxG.updateFramerate = framerate;
|
||||
else FlxG.updateFramerate = FlxG.drawFramerate = framerate;
|
||||
}
|
||||
|
||||
public static function applyKeybinds() {
|
||||
|
||||
@@ -48,12 +48,29 @@ class AdvancedAppearanceOptions extends TreeMenuScreen {
|
||||
}
|
||||
|
||||
private function updateQualityOptions() {
|
||||
for (option in qualityOptions) option.locked = Options.quality != 2;
|
||||
for (option in qualityOptions) {
|
||||
option.locked = Options.quality != 2;
|
||||
if (option is Checkbox) {
|
||||
final checkbox:Checkbox = cast option;
|
||||
checkbox.checked = Reflect.field(checkbox.parent, checkbox.optionName);
|
||||
}
|
||||
else if (option is SliderOption) {
|
||||
final slider:SliderOption = cast option;
|
||||
slider.currentValue = Reflect.field(slider.parent, slider.optionName);
|
||||
}
|
||||
else if (option is NumOption) {
|
||||
final num:NumOption = cast option;
|
||||
num.currentValue = Reflect.field(num.parent, num.optionName);
|
||||
}
|
||||
else if (option is ArrayOption) {
|
||||
final array:ArrayOption = cast option;
|
||||
array.currentSelection = Reflect.field(array.parent, array.optionName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function __changeQuality(value:Dynamic) {
|
||||
var antialiasing = value == 0 ? false : (value == 1 ? true : Options.antialiasing);
|
||||
FlxG.game.stage.quality = (FlxG.enableAntialiasing = antialiasing) ? BEST : LOW;
|
||||
Options.applyQuality();
|
||||
updateQualityOptions();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,19 @@ class ArrayOption extends TextOption {
|
||||
|
||||
public var options:Array<Dynamic>;
|
||||
public var displayOptions:Array<String>;
|
||||
public var currentSelection:Int;
|
||||
public var currentSelection(default, set):Int;
|
||||
|
||||
public var parent:Dynamic;
|
||||
public var optionName:String;
|
||||
|
||||
var __selectionText:Alphabet;
|
||||
|
||||
function set_currentSelection(v:Int):Int {
|
||||
currentSelection = v;
|
||||
if (__selectionText != null) __selectionText.text = formatTextOption();
|
||||
return v;
|
||||
}
|
||||
|
||||
override function set_text(v:String) {
|
||||
super.set_text(v);
|
||||
__selectionText.x = __text.x + __text.width + 12;
|
||||
@@ -53,7 +59,6 @@ class ArrayOption extends TextOption {
|
||||
|
||||
override function changeSelection(change:Int) {
|
||||
if (locked || currentSelection == (currentSelection = CoolUtil.boundInt(currentSelection + change, 0, options.length - 1))) return;
|
||||
__selectionText.text = formatTextOption();
|
||||
CoolUtil.playMenuSFX(SCROLL);
|
||||
|
||||
if (optionName != null) Reflect.setField(parent, optionName, options[currentSelection]);
|
||||
|
||||
@@ -10,14 +10,19 @@ class NumOption extends TextOption {
|
||||
public var max:Float;
|
||||
public var step:Float;
|
||||
|
||||
public var currentValue:Float;
|
||||
public var currentValue(default, set):Float;
|
||||
|
||||
public var parent:Dynamic;
|
||||
public var optionName:String;
|
||||
|
||||
var __number:Alphabet;
|
||||
|
||||
override function set_text(v:String) {
|
||||
function set_currentValue(v:Float):Float {
|
||||
if (__number != null) __number.text = ": $v";
|
||||
return currentValue = v;
|
||||
}
|
||||
|
||||
override function set_text(v:String):String {
|
||||
super.set_text(v);
|
||||
__number.x = __text.x + __text.width + 12;
|
||||
return v;
|
||||
@@ -41,7 +46,6 @@ class NumOption extends TextOption {
|
||||
override function changeSelection(change:Int):Void {
|
||||
if (locked) return;
|
||||
if (currentValue == (currentValue = FlxMath.bound(currentValue + change * step, min, max))) return;
|
||||
__number.text = ': $currentValue';
|
||||
|
||||
Reflect.setField(parent, optionName, currentValue);
|
||||
if (changedCallback != null) changedCallback(currentValue);
|
||||
|
||||
Reference in New Issue
Block a user