diff --git a/Content.Client/EscapeMenu/UI/Tabs/GraphicsTab.xaml b/Content.Client/EscapeMenu/UI/Tabs/GraphicsTab.xaml
index 13ab7ecb0b..f8ae37134a 100644
--- a/Content.Client/EscapeMenu/UI/Tabs/GraphicsTab.xaml
+++ b/Content.Client/EscapeMenu/UI/Tabs/GraphicsTab.xaml
@@ -30,6 +30,9 @@
MinWidth="200" />
+
diff --git a/Content.Client/EscapeMenu/UI/Tabs/GraphicsTab.xaml.cs b/Content.Client/EscapeMenu/UI/Tabs/GraphicsTab.xaml.cs
index dc4b1f495f..db27898a79 100644
--- a/Content.Client/EscapeMenu/UI/Tabs/GraphicsTab.xaml.cs
+++ b/Content.Client/EscapeMenu/UI/Tabs/GraphicsTab.xaml.cs
@@ -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));
}
}
diff --git a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl
index d14a01d830..6ee69cb997 100644
--- a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl
+++ b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl
@@ -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