Adds integer scaling option (#4300)
* Adds integer scaling option * RobustToolbox * Update option name and tooltip
This commit is contained in:
@@ -30,6 +30,9 @@
|
||||
MinWidth="200" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
<CheckBox Name="IntegerScalingCheckBox"
|
||||
Text="{Loc 'ui-options-vp-integer-scaling'}"
|
||||
ToolTip="{Loc 'ui-options-vp-integer-scaling-tooltip'}" />
|
||||
<CheckBox Name="ViewportLowResCheckBox" Text="{Loc 'ui-options-vp-low-res'}" />
|
||||
</BoxContainer>
|
||||
<hudUi:StripeBack HasBottomEdge="False" HasMargins="False">
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
||||
UpdateViewportScale();
|
||||
};
|
||||
|
||||
IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
|
||||
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
|
||||
ApplyButton.OnPressed += OnApplyButtonPressed;
|
||||
VSyncCheckBox.Pressed = _cfg.GetCVar(CVars.DisplayVSync);
|
||||
@@ -82,6 +83,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
||||
HudThemeOption.SelectId(_cfg.GetCVar(CCVars.HudTheme));
|
||||
ViewportScaleSlider.Value = _cfg.GetCVar(CCVars.ViewportFixedScaleFactor);
|
||||
ViewportStretchCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportStretch);
|
||||
IntegerScalingCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0;
|
||||
ViewportLowResCheckBox.Pressed = !_cfg.GetCVar(CCVars.ViewportScaleRender);
|
||||
|
||||
UpdateViewportScale();
|
||||
@@ -114,6 +116,8 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
||||
_cfg.SetCVar(CVars.DisplayUIScale, UIScaleOptions[UIScaleOption.SelectedId]);
|
||||
_cfg.SetCVar(CCVars.ViewportStretch, ViewportStretchCheckBox.Pressed);
|
||||
_cfg.SetCVar(CCVars.ViewportFixedScaleFactor, (int) ViewportScaleSlider.Value);
|
||||
_cfg.SetCVar(CCVars.ViewportSnapToleranceMargin,
|
||||
IntegerScalingCheckBox.Pressed ? CCVars.ViewportSnapToleranceMargin.DefaultValue : 0);
|
||||
_cfg.SetCVar(CCVars.ViewportScaleRender, !ViewportLowResCheckBox.Pressed);
|
||||
_cfg.SaveToFile();
|
||||
UpdateApplyButton();
|
||||
@@ -139,6 +143,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
||||
var isUIScaleSame = MathHelper.CloseTo(UIScaleOptions[UIScaleOption.SelectedId], ConfigUIScale);
|
||||
var isVPStretchSame = ViewportStretchCheckBox.Pressed == _cfg.GetCVar(CCVars.ViewportStretch);
|
||||
var isVPScaleSame = (int) ViewportScaleSlider.Value == _cfg.GetCVar(CCVars.ViewportFixedScaleFactor);
|
||||
var isIntegerScalingSame = IntegerScalingCheckBox.Pressed == (_cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0);
|
||||
var isVPResSame = ViewportLowResCheckBox.Pressed == !_cfg.GetCVar(CCVars.ViewportScaleRender);
|
||||
|
||||
ApplyButton.Disabled = isVSyncSame &&
|
||||
@@ -147,6 +152,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
||||
isUIScaleSame &&
|
||||
isVPStretchSame &&
|
||||
isVPScaleSame &&
|
||||
isIntegerScalingSame &&
|
||||
isVPResSame &&
|
||||
isHudThemeSame;
|
||||
}
|
||||
@@ -217,6 +223,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
||||
private void UpdateViewportScale()
|
||||
{
|
||||
ViewportScaleBox.Visible = !ViewportStretchCheckBox.Pressed;
|
||||
IntegerScalingCheckBox.Visible = ViewportStretchCheckBox.Pressed;
|
||||
ViewportScaleText.Text = Loc.GetString("ui-options-vp-scale", ("scale", ViewportScaleSlider.Value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,14 @@ ui-options-hud-theme = HUD Theme:
|
||||
ui-options-hud-theme-default = Default
|
||||
ui-options-hud-theme-modernized = Modernized
|
||||
ui-options-hud-theme-classic = Classic
|
||||
ui-options-vp-stretch = Stretch viewport to fit game window?
|
||||
ui-options-vp-stretch = Stretch viewport to fit game window
|
||||
ui-options-vp-scale = Fixed viewport scale: x{ $scale }
|
||||
ui-options-vp-low-res = Low-resolution viewport?
|
||||
ui-options-vp-integer-scaling = Prefer integer scaling (might cause black bars/clipping)
|
||||
ui-options-vp-integer-scaling-tooltip = If this option is enabled, the viewport will be scaled using an integer value
|
||||
at specific resolutions. While this results in crisp textures, it also often
|
||||
means that black bars appear at the top/bottom of the screen or that part
|
||||
of the viewport is not visible.
|
||||
ui-options-vp-low-res = Low-resolution viewport
|
||||
|
||||
## Controls menu
|
||||
|
||||
|
||||
Reference in New Issue
Block a user