Roses/Assets/Scripts/View/DisplaySetup.cs
2024-04-18 11:16:43 +02:00

24 lines
No EOL
806 B
C#

using SatorImaging.AppWindowUtility;
using UnityEngine;
namespace View {
internal static class DisplaySetup {
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
private static void Setup() {
#if !UNITY_EDITOR
AppWindowUtility.AlwaysOnTop = true;
AppWindowUtility.FrameVisibility = false;
AppWindowUtility.Transparent = true;
Vector2Int displaySize = new(Screen.currentResolution.width, Screen.currentResolution.height);
const float aspect = 10f / 15f;
int windowHeight = (int)(displaySize.y * .45f);
int windowWidth = (int)(windowHeight * aspect);
int margin = (int)(displaySize.x * .01f);
AppWindowUtility.ResizeWindow(windowWidth, windowHeight);
AppWindowUtility.MoveWindow(displaySize.x - windowWidth - margin, margin);
#endif
}
}
}