#pragma once #include "CoreMinimal.h" /** * Constants of the user interface (UI/ folder; DESIGN_UE.md section 8.5, requirement V13). * Every size is in UI units. One UI unit is one pixel of the viewport at 1080p and below; above 1080p the whole UI is * scaled up (UiScaleForViewport) so a 4K screen shows the 1080p layout, not a tiny one. Colours live in UI/NeuStyle.cpp * (they are not constexpr), everything else lives here. */ namespace Descent::Tune::UI { // ---- scale ---------------------------------------------------------------------------------------------------- /** Short side of the viewport at which one UI unit equals one pixel; larger screens scale up from there. */ constexpr float ReferenceShortSidePx = 1080.f; /** Viewport width under which the HUD uses its narrow rules (section 8.5: gauges 56 px, radio under the depth panel...). */ constexpr float NarrowWidthPx = 900.f; /** Viewport height under which the HUD uses compact heights. */ constexpr float CompactHeightPx = 640.f; // ---- neumorphic style (section 8.5) --------------------------------------------------------------------------- constexpr float CornerRadiusPx = 16.f; /** Soft shadow: dark one at (+Soft, +Soft), light one at (-SoftLight, -SoftLight), blur sigma in px. */ constexpr float ShadowSoftSigmaPx = 7.f; constexpr float ShadowSoftDarkOffsetPx = 6.f; constexpr float ShadowSoftLightOffsetPx = 5.f; /** Small shadow, for slots, buttons and anything under ~60 px. */ constexpr float ShadowSmallSigmaPx = 3.5f; constexpr float ShadowSmallDarkOffsetPx = 3.f; constexpr float ShadowSmallLightOffsetPx = 3.f; /** How far out the blur is generated: this many sigmas. Beyond it the alpha is below 0.2 percent. */ constexpr float ShadowReachSigmas = 3.f; /** Strength of the two shadows (alpha multiplier) and of the body's top-to-bottom gradient (fraction of the colour). */ constexpr float ShadowDarkStrength = 1.0f; constexpr float ShadowLightStrength = 1.0f; constexpr float BodyGradient = 0.045f; /** Disabled widgets are drawn at this opacity (section 8.5: 35 percent). */ constexpr float DisabledOpacity = 0.35f; /** Cap on cached exact-size shadow textures before the cache is flushed (they are small). */ constexpr int32 ShadowCacheLimit = 192; // ---- widget sizes --------------------------------------------------------------------------------------------- constexpr float HotbarSlotPx = 52.f; constexpr float InventoryCellPx = 74.f; constexpr float RowIconPx = 40.f; constexpr float ButtonHeightPx = 38.f; constexpr float SliderTrackPx = 12.f; constexpr float SliderThumbPx = 26.f; constexpr float ProgressHeightPx = 14.f; // ---- HUD (section 8.5 layout table) --------------------------------------------------------------------------- constexpr float HudMarginPx = 14.f; constexpr float HudGaugeWidePx = 72.f; constexpr float HudGaugeNarrowPx = 56.f; constexpr float HudObjectiveMaxFraction = 0.30f; constexpr float HudObjectiveMinWidthPx = 190.f; constexpr float HudObjectiveFoldedHeightPx = 30.f; constexpr float HudToastHeightPx = 34.f; constexpr float HudToastGapPx = 6.f; constexpr float HudToastWidthPx = 300.f; constexpr float HudRadioMaxWidthPx = 560.f; constexpr float HudRadioHeightPx = 32.f; constexpr float HudRadioGapPx = 16.f; constexpr float HudPromptHeightPx = 32.f; constexpr float HudPromptMaxWidthPx = 380.f; constexpr float HudPromptOffsetPx = 30.f; constexpr float HudProximityWidthPx = 168.f; constexpr float HudProximityRowPx = 24.f; constexpr float HudWarningHeightPx = 30.f; /** Seconds a toast spends fading out at the end of its life. */ constexpr float HudToastFadeSec = 0.6f; // ---- windows (section 8.5) ------------------------------------------------------------------------------------ constexpr float WindowMaxWidthPx = 980.f; constexpr float WindowMaxHeightPx = 640.f; constexpr float WindowScreenMarginPx = 10.f; constexpr float WindowHeaderHeightPx = 56.f; /** The scrim drawn over the game while a window is open. */ constexpr float WindowScrimAlpha = 0.55f; // ---- dashboards (section 4.6) --------------------------------------------------------------------------------- constexpr float DashDrawWidthPx = 1024.f; constexpr float DashDrawHeightPx = 420.f; constexpr float CargoDrawSizePx = 512.f; constexpr int32 CargoColumns = 4; /** A new chunk drops into the hold over this long. */ constexpr float CargoDropSec = 0.3f; /** The dashboards redraw this often (section 1.4: dashboards at 8 Hz), and at once when the rounded depth changes. */ constexpr float DashRedrawHz = 8.f; /** Hull and power colours go red below these (section 4.6). */ constexpr float DashHullRedPct = 30.f; constexpr float DashPowerRedPct = 20.f; /** Depth bar range in metres (section 4.6: between 1,740 and 3,400 m). */ constexpr double DashDepthBarMinM = 1740.0; constexpr double DashDepthBarMaxM = 3400.0; // ---- pause window --------------------------------------------------------------------------------------------- /** The console variable the Bloom slider is bound to (created by the look track). */ inline const TCHAR* BloomCVarName() { return TEXT("descent.Look.Bloom"); } /** The slider spans 0..this; a variable whose value is larger than this widens the span. */ constexpr float BloomSliderMax = 1.0f; /** UI scale for a viewport (see the file comment): 1 up to the reference, then proportional to the short side. */ inline float UiScaleForViewport(float WidthPx, float HeightPx) { const float Short = FMath::Min(WidthPx, HeightPx); return FMath::Max(1.f, Short / ReferenceShortSidePx); } }