This commit is contained in:
SoulliesOfficial
2025-12-17 04:19:38 -05:00
parent 7c1cb7e8e1
commit d15957c719
4315 changed files with 8260710 additions and 2940 deletions

View File

@@ -0,0 +1,36 @@
using UnityEngine;
namespace GraphicsCat
{
public class ResolutionUtils
{
readonly public static Resolution s_DefaultResolution = Screen.currentResolution;
readonly public static ScreenOrientation s_DefaultOrientation = Screen.orientation;
public static float defaultLandscapeHeight
{
get
{
return (float)Mathf.Min(s_DefaultResolution.width, s_DefaultResolution.height);
}
}
public static float resolutionScale
{
get
{
var currentResolution = Screen.currentResolution;
var defaultMaxWidthHeight = (float)Mathf.Max(s_DefaultResolution.width, s_DefaultResolution.height);
var currentMaxWidthHeight = (float)Mathf.Max(currentResolution.width, currentResolution.height);
return currentMaxWidthHeight / defaultMaxWidthHeight;
}
set
{
var isDefaultOrientation = (s_DefaultOrientation == Screen.orientation);
var newWidth = isDefaultOrientation ? s_DefaultResolution.width : s_DefaultResolution.height;
var newHeight = isDefaultOrientation ? s_DefaultResolution.height : s_DefaultResolution.width;
Screen.SetResolution((int)(newWidth * value), (int)(newHeight * value), true);
}
}
}
}