#pragma once #include "CoreMinimal.h" #include "UI/DescentHudLayout.h" #include "UI/NeuStyle.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/SLeafWidget.h" class UWorld; /** * The HUD (DESIGN_UE.md section 8.5): one Slate widget that fills the viewport and paints every region of the layout * table from an FDescentHudModel. It never takes the mouse. The regions' rectangles come from FDescentHudLayout, the same * function the headless layout test and the `ui.widgets` state part use. */ class THEDESCENT_API SDescentHUD : public SLeafWidget { public: SLATE_BEGIN_ARGS(SDescentHUD) {} SLATE_ARGUMENT(TWeakObjectPtr, World) /** Returns the model to draw (null = draw nothing). Called every paint. */ SLATE_ARGUMENT(TFunction, Model) SLATE_END_ARGS() void Construct(const FArguments& InArgs); virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override; virtual FVector2D ComputeDesiredSize(float) const override { return FVector2D::ZeroVector; } /** Paints a model with a layout, at the given time (seconds, for blinking). World may be null (no world markers then). */ static void PaintModel(FNeuPainter& P, const FDescentHudModel& Model, const FDescentHudLayout& Layout, double TimeSeconds, UWorld* World); private: TWeakObjectPtr World; TFunction ModelFn; };