Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion AATool/Configuration/MainConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ public class MainConfig : Config
{"High Contrast", (Hex("000000"), Hex("FFFFFF"), Hex("FFFFFF"))}
};

public static readonly Dictionary<string, double> DisplayScales = new ()
{
{"100%", 1 },
{"125%", 1.25 },
{"150%", 1.5 },
{"175%", 1.75 },
{"200%", 2 },
};

private static Color Hex(string hex) =>
ColorHelper.TryGetHexColor(hex, out Color color) ? color : Color.White;

[JsonProperty] public readonly Setting<int> FpsCap = new (60);
[JsonProperty] public readonly Setting<int> DisplayScale = new (1);
[JsonProperty] public readonly Setting<double> DisplayScale = new (1);

[JsonProperty] public readonly Setting<bool> AllowUserResizing = new (false);
[JsonProperty] public readonly Setting<bool> HideCompletedAdvancements = new (false);
Expand Down
4 changes: 3 additions & 1 deletion AATool/UI/Screens/UIMainScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ protected override void ConstrainWindow()
RenderCache?.Dispose();
RenderCache = new RenderTarget2D(this.GraphicsDevice, width, height);
}
this.Form.ClientSize = new System.Drawing.Size(width * Config.Main.DisplayScale, height * Config.Main.DisplayScale);
int clientWidth = Convert.ToInt32(Convert.ToDouble(width) * Config.Main.DisplayScale);
int clientHeight = Convert.ToInt32(Convert.ToDouble(height) * Config.Main.DisplayScale);
this.Form.ClientSize = new System.Drawing.Size(clientWidth, clientHeight);

//snap window to user's preferred location
if (!this.Positioned || Config.Main.StartupArrangement.Changed || Config.Main.StartupDisplay.Changed)
Expand Down
41 changes: 28 additions & 13 deletions AATool/Winforms/Controls/CMainSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 21 additions & 2 deletions AATool/Winforms/Controls/CMainSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public void LoadSettings()
this.viewMode.Text = Main.TextInfo.ToTitleCase(Config.Main.Layout.Value);
this.hideBasic.Checked = !Config.Main.ShowBasicAdvancements;
this.ambientGlow.Checked = Config.Main.ShowAmbientGlow;
this.highRes.Checked = Config.Main.DisplayScale > 1;
this.frameStyle.Text = Config.Main.FrameStyle;
this.progressBarStyle.Text = Config.Main.ProgressBarStyle;
this.refreshIcon.Text = Config.Main.RefreshIcon;
Expand All @@ -51,6 +50,15 @@ public void LoadSettings()
this.startupMonitor.SelectedIndex = MathHelper.Clamp(Config.Main.StartupDisplay - 1, 0, this.startupMonitor.Items.Count - 1);
this.startupMonitor.Enabled = this.startupPosition.Text != "Remember";

// display scale
this.highRes.Items.Clear();
foreach (KeyValuePair<string, double> displayScale in Config.MainConfig.DisplayScales)
{
this.highRes.Items.Add(displayScale.Key);
if (Config.Main.DisplayScale == displayScale.Value)
this.highRes.Text = displayScale.Key;
}

//colors
this.theme.Items.Clear();
foreach (KeyValuePair<string, (Color, Color, Color)> theme in Config.MainConfig.Themes)
Expand Down Expand Up @@ -82,7 +90,6 @@ private void SaveSettings()
Config.Main.HideCompletedAdvancements.Set(this.hideCompletedAdvancements.Checked);
Config.Main.HideCompletedCriteria.Set(this.hideCompletedCriteria.Checked);
Config.Main.ShowAmbientGlow.Set(this.ambientGlow.Checked);
Config.Main.DisplayScale.Set(this.highRes.Checked ? 2 : 1);
Config.Main.Layout.Set(this.viewMode.Text.ToLower());
Config.Main.FrameStyle.Set(this.frameStyle.Text);
Config.Main.ProgressBarStyle.Set(this.progressBarStyle.Text);
Expand Down Expand Up @@ -342,6 +349,18 @@ private void OnIndexChanged(object sender, EventArgs e)
Config.Main.RainbowMode.Set(false);
}
}
if (sender == this.highRes)
{
string displayScaleText = this.highRes.Text;
if (Config.MainConfig.DisplayScales.TryGetValue(displayScaleText, out double displayScale))
{
Config.Main.DisplayScale.Set(displayScale);
}
else
{
Config.Main.DisplayScale.Set(1);
}
}
else if (sender == this.startupPosition)
{
this.startupMonitor.Enabled = this.startupPosition.Text != "Remember";
Expand Down