#include "UI/DescentUiLayer.h" #include "Core/Tuning/DescentTune_UI.h" #include "Widgets/Layout/SDPIScaler.h" void SDescentUiLayer::Construct(const FArguments& InArgs) { SetVisibility(EVisibility::SelfHitTestInvisible); ChildSlot [ SAssignNew(Scaler, SDPIScaler) .DPIScale(this, &SDescentUiLayer::GetChildScale) [ InArgs._Content.Widget ] ]; } void SDescentUiLayer::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) { SCompoundWidget::Tick(AllottedGeometry, InCurrentTime, InDeltaTime); // Scale from this layer's local space to window pixels (the engine's DPI scaler is above us). const float Total = FMath::Max(0.01f, AllottedGeometry.GetAccumulatedLayoutTransform().GetScale()); const FVector2f Px = AllottedGeometry.GetLocalSize() * Total; UiScale = Descent::Tune::UI::UiScaleForViewport(Px.X, Px.Y); ChildScale = UiScale / Total; LayoutSize = Px / UiScale; }