| 12345678910111213141516171819 |
- using System;
- namespace DevilLink2.UI
- {
- public static class ScreenLayout
- {
- public const float Width = 430, Height = 932;
- public const float HudHeight = 56, DockReserve = 82, CardGap = 8, CardInset = 12;
- public const float CardHeight = (Height - HudHeight - DockReserve - 20 - CardGap * 2) / 3;
- public static float CardTop(int index)
- { if (index < 0 || index > 2) throw new ArgumentOutOfRangeException(nameof(index)); return HudHeight + 10 + index * (CardHeight + CardGap); }
- public static float FitScale(float width, float height)
- {
- if (float.IsNaN(width) || float.IsNaN(height) || float.IsInfinity(width) || float.IsInfinity(height) || width < 0 || height < 0)
- throw new ArgumentOutOfRangeException(nameof(width));
- return Math.Min(width / Width, height / Height);
- }
- }
- }
|