MCPcopy Create free account
hub / github.com/DruidMech/MultiplayerCourseBlasterGame / DrawHUD

Method DrawHUD

Source/Blaster/HUD/BlasterHUD.cpp:91–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void ABlasterHUD::DrawHUD()
92{
93 Super::DrawHUD();
94
95 FVector2D ViewportSize;
96 if (GEngine)
97 {
98 GEngine->GameViewport->GetViewportSize(ViewportSize);
99 const FVector2D ViewportCenter(ViewportSize.X / 2.f, ViewportSize.Y / 2.f);
100
101 float SpreadScaled = CrosshairSpreadMax * HUDPackage.CrosshairSpread;
102
103 if (HUDPackage.CrosshairsCenter)
104 {
105 FVector2D Spread(0.f, 0.f);
106 DrawCrosshair(HUDPackage.CrosshairsCenter, ViewportCenter, Spread, HUDPackage.CrosshairsColor);
107 }
108 if (HUDPackage.CrosshairsLeft)
109 {
110 FVector2D Spread(-SpreadScaled, 0.f);
111 DrawCrosshair(HUDPackage.CrosshairsLeft, ViewportCenter, Spread, HUDPackage.CrosshairsColor);
112 }
113 if (HUDPackage.CrosshairsRight)
114 {
115 FVector2D Spread(SpreadScaled, 0.f);
116 DrawCrosshair(HUDPackage.CrosshairsRight, ViewportCenter, Spread, HUDPackage.CrosshairsColor);
117 }
118 if (HUDPackage.CrosshairsTop)
119 {
120 FVector2D Spread(0.f, -SpreadScaled);
121 DrawCrosshair(HUDPackage.CrosshairsTop, ViewportCenter, Spread, HUDPackage.CrosshairsColor);
122 }
123 if (HUDPackage.CrosshairsBottom)
124 {
125 FVector2D Spread(0.f, SpreadScaled);
126 DrawCrosshair(HUDPackage.CrosshairsBottom, ViewportCenter, Spread, HUDPackage.CrosshairsColor);
127 }
128 }
129}
130
131void ABlasterHUD::DrawCrosshair(UTexture2D* Texture, FVector2D ViewportCenter, FVector2D Spread, FLinearColor CrosshairColor)
132{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected