Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some window UIScale bugs #5499

Merged
merged 2 commits into from
Oct 18, 2024
Merged
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
2 changes: 2 additions & 0 deletions Robust.Client/Graphics/Clyde/Clyde.Windowing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ public IClydeWindow CreateWindow(WindowCreateParameters parameters)
if (isMain)
_mainWindow = reg;

reg.IsVisible = parameters.Visible;

_windows.Add(reg);
_windowHandles.Add(reg.Handle);

Expand Down
5 changes: 3 additions & 2 deletions Robust.Client/UserInterface/Controls/OSWindow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
using System.Numerics;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
Expand Down Expand Up @@ -138,6 +137,8 @@ public IClydeWindow Create()
_root = UserInterfaceManager.CreateWindowRoot(ClydeWindow);
_root.AddChild(this);

// Resize the window by our UIScale
ClydeWindow.Size = new((int)(ClydeWindow.Size.X * UIScale), (int)(ClydeWindow.Size.Y * UIScale));
return ClydeWindow;
}

Expand Down Expand Up @@ -192,7 +193,7 @@ private void OnWindowDestroyed(WindowDestroyedEventArgs obj)

private void OnWindowResized(WindowResizedEventArgs obj)
{
SetSize = obj.NewSize;
SetSize = obj.NewSize / UIScale;
}

private void RealClosed()
Expand Down
6 changes: 4 additions & 2 deletions Robust.Client/UserInterface/UserInterfaceManager.Roots.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Shared;
using Robust.Shared.Map;
using Robust.Shared.Utility;

Expand All @@ -28,10 +29,11 @@ public WindowRoot CreateWindowRoot(IClydeWindow window)
{
MouseFilter = Control.MouseFilterMode.Ignore,
HorizontalAlignment = Control.HAlignment.Stretch,
VerticalAlignment = Control.VAlignment.Stretch,
UIScaleSet = window.ContentScale.X
VerticalAlignment = Control.VAlignment.Stretch
};

newRoot.UIScaleSet = CalculateAutoScale(newRoot);

_roots.Add(newRoot);
_windowsToRoot.Add(window.Id, newRoot);

Expand Down
Loading