Skip to content

Commit

Permalink
Fix resolution on high dpi screen
Browse files Browse the repository at this point in the history
  • Loading branch information
yojohanshinwataikei committed Sep 2, 2023
1 parent cc60279 commit 6e719ef
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Assets/Misc/BuildTimestamp.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
638293053009126639
638293106792303315
1 change: 1 addition & 0 deletions Assets/Misc/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- 现在鼠标悬浮在背景上时也可以取消选中物件了
- 现在使用撤销可以取消正在进行的操作了
- 调整了实际渲染时的谱面流速
- 修复在高 dpi 屏幕上窗口大小设置错误的问题
- 调整了部分滚动条对滚轮操作的灵敏度
- 改用 URP 进行渲染, 可能会带来性能提升
- 修复较高分辨率下轨道的微小渲染问题
12 changes: 9 additions & 3 deletions Assets/Scripts/Compose/ArcadeComposeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private void CheckScroll()
if (timing > GameplayManager.Length) timing = GameplayManager.Length;
if (timing < 0) timing = 0;

if (GameplayManager.Timing != Mathf.RoundToInt(timing) )
if (GameplayManager.Timing != Mathf.RoundToInt(timing))
{
GameplayManager.Timing = Mathf.RoundToInt(timing);
GameplayManager.ResetJudge();
Expand Down Expand Up @@ -361,10 +361,16 @@ public void SetResolution(string resolution, bool fullscreen)
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, FullScreenMode.FullScreenWindow);
return;
}
Debug.Log($"[dpi]{Screen.dpi}");
float scaleRatio = Screen.dpi / 96f;
if (scaleRatio <= 0.01f)
{
scaleRatio = 1f;
}
// here we do not check format of string
string[] dimensions = resolution.Split('x');
int width = int.Parse(dimensions[0]);
int height = int.Parse(dimensions[1]);
int width = Mathf.RoundToInt(int.Parse(dimensions[0]) * scaleRatio);
int height = Mathf.RoundToInt(int.Parse(dimensions[1]) * scaleRatio);
Screen.SetResolution(width, height, FullScreenMode.Windowed);
}
public void SetTargetFramerate(int fps)
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PlayerSettings:
m_ShowUnitySplashScreen: 1
m_ShowUnitySplashLogo: 1
m_SplashScreenOverlayOpacity: 1
m_SplashScreenAnimation: 1
m_SplashScreenAnimation: 0
m_SplashScreenLogoStyle: 1
m_SplashScreenDrawMode: 1
m_SplashScreenBackgroundAnimationZoom: 0
Expand All @@ -40,7 +40,7 @@ PlayerSettings:
width: 1
height: 1
m_SplashScreenLogos:
- logo: {fileID: 10404, guid: 0000000000000000e000000000000000, type: 0}
- logo: {fileID: 10404, guid: 0000000000000000f000000000000000, type: 0}
duration: 2
m_VirtualRealitySplashScreen: {fileID: 0}
m_HolographicTrackingLossScreen: {fileID: 0}
Expand Down

0 comments on commit 6e719ef

Please sign in to comment.