Navigation
API > API/Runtime > API/Runtime/Engine
Base class of the heads-up display. This has a canvas and a debug canvas on which primitives can be drawn. It also contains a list of simple hit boxes that can be used for simple item click detection. A method of rendering debug text is also included. Provides some simple methods for rendering text, textures, rectangles and materials which can also be accessed from blueprints.
| Name | AHUD |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/GameFramework/HUD.h |
| Include Path | #include "GameFramework/HUD.h" |
Syntax
UCLASS (Config=Game, HideCategories=(Rendering, Actor, Input, Replication),
ShowCategories=("Input|MouseInput", "Input|TouchInput"), NotPlaceable, Transient,
BlueprintType, Blueprintable, MinimalAPI)
class AHUD : public AActor
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → AActor → AHUD
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
AHUD
(
const FObjectInitializer& ObjectInitializer |
GameFramework/HUD.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| OnHUDPostRender | FOnHUDPostRender | Called from PostRender. For less player/actor centered debugging. | GameFramework/HUD.h |
| OnShowDebugInfo | FOnShowDebugInfo | Callback allowing external systems to register to show debug info. | GameFramework/HUD.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bEnableDebugTextShadow | uint8 | Put shadow on debug strings | GameFramework/HUD.h |
|
| bLostFocusPaused | uint8 | Tells whether the game was paused due to lost focus | GameFramework/HUD.h |
|
| bShowDebugInfo | uint8 | If true, current ViewTarget shows debug information using its DisplayDebug(). | GameFramework/HUD.h |
|
| bShowHitBoxDebugInfo | uint8 | If true, show hitbox debugging info. | GameFramework/HUD.h |
|
| bShowHUD | uint8 | Whether or not the HUD should be drawn. | GameFramework/HUD.h |
|
| bShowOverlays | uint8 | If true, render actor overlays. | GameFramework/HUD.h |
|
| CurrentTargetIndex | int32 | Current target in our considered Targets list for 'showdebug' | GameFramework/HUD.h |
|
| DebugDisplay | TArray< FName > | Array of names specifying what debug info to display for viewtarget actor. | GameFramework/HUD.h |
|
| HitBoxesOver | TSet< FName > | Set of hitbox (by name) that are currently moused over or have a touch contacting them | GameFramework/HUD.h | |
| HitBoxHits | TArray< FHUDHitBox * > | Array of hitboxes that have been hit for this frame. | GameFramework/HUD.h | |
| HitBoxMap | TArray< FHUDHitBox > | Array of hitboxes for this frame. | GameFramework/HUD.h | |
| LastHUDRenderTime | float | Used to calculate delta time between HUD rendering. | GameFramework/HUD.h | |
| PlayerOwner | TObjectPtr< APlayerController > | PlayerController which owns this HUD. | GameFramework/HUD.h |
|
| PostRenderedActors | TArray< TObjectPtr< AActor > > | Holds a list of Actors that need PostRender() calls. | GameFramework/HUD.h | |
| RenderDelta | float | Time since last HUD render. | GameFramework/HUD.h | |
| ToggledDebugCategories | TArray< FName > | Array of names specifying what subsets of debug info to display for viewtarget actor. | GameFramework/HUD.h |
|
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bShowDebugForReticleTarget | uint8 | If true show debug info for 'ShowDebugTargetActor', otherwise for Camera Viewtarget | GameFramework/HUD.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddDebugText
(
const FString& DebugText, |
Add debug text for a specific actor to be displayed via DrawDebugTextList(). | GameFramework/HUD.h |
|
void AddHitBox
(
FVector2D Position, |
Add a hitbox to the hud | GameFramework/HUD.h |
|
virtual void AddPostRenderedActor
(
AActor* A |
Add an actor to the PostRenderedActors array | GameFramework/HUD.h | |
bool AnyCurrentHitBoxHits() |
Have any hitboxes been hit this frame. | GameFramework/HUD.h | |
void Deproject
(
float ScreenX, |
Transforms a 2D screen location into a 3D location and direction | GameFramework/HUD.h |
|
void Draw2DLine
(
int32 X1, |
Draws a colored line between two points | GameFramework/HUD.h | |
void Draw3DLine
(
FVector Start, |
Draws a colored line between two points | GameFramework/HUD.h | |
virtual void DrawActorOverlays
(
FVector Viewpoint, |
Draw overlays for actors that were rendered this tick and have added themselves to the PostRenderedActors array | GameFramework/HUD.h | |
void DrawDebugTextList () |
Iterate through list of debug text and draw it over the associated actors in world space. | GameFramework/HUD.h | |
virtual void DrawHUD() |
The Main Draw loop for the hud. Gets called before any messaging. Should be subclassed | GameFramework/HUD.h | |
void DrawLine
(
float StartScreenX, |
Draws a 2D line on the HUD. | GameFramework/HUD.h |
|
void DrawMaterial
(
UMaterialInterface* Material, |
Draws a material-textured quad on the HUD. | GameFramework/HUD.h |
|
void DrawMaterialSimple
(
UMaterialInterface* Material, |
Draws a material-textured quad on the HUD. Assumes UVs such that the entire material is shown. | GameFramework/HUD.h |
|
void DrawMaterialTriangle
(
UMaterialInterface* Material, |
GameFramework/HUD.h |
|
|
void DrawRect
(
FLinearColor RectColor, |
Draws a colored untextured quad on the HUD. | GameFramework/HUD.h |
|
virtual void DrawSafeZoneOverlay() |
Draw the safe zone debugging overlay when enabled | GameFramework/HUD.h | |
void DrawText
(
const FString& Text, |
Draws a string on the HUD. | GameFramework/HUD.h |
|
void DrawTexture
(
UTexture* Texture, |
Draws a textured quad on the HUD. | GameFramework/HUD.h |
|
void DrawTextureSimple
(
UTexture* Texture, |
Draws a textured quad on the HUD. Assumes 1:1 texel density. | GameFramework/HUD.h |
|
bool GetActorsInSelectionRectangle
(
const FVector2D& FirstPoint, |
Returns the array of actors inside a selection rectangle, with a class filter. | GameFramework/HUD.h | |
void GetActorsInSelectionRectangle
(
TSubclassOf< AActor > ClassFilter, |
Returns the array of actors inside a selection rectangle, with a class filter. | GameFramework/HUD.h |
|
virtual AActor * GetCurrentDebugTargetActor() |
Get Target to view 'showdebug' on | GameFramework/HUD.h | |
| Get list of considered targets for 'showdebug' This list is built contextually based on which 'showdebug' flags have been enabled. | GameFramework/HUD.h | ||
virtual UFont * GetFontFromSizeIndex
(
int32 FontSizeIndex |
Messaging. | GameFramework/HUD.h | |
const FHUDHitBox * GetHitBoxAtCoordinates
(
FVector2D InHitLocation, |
Find the first hitbox containing the given coordinates. | GameFramework/HUD.h | |
void GetHitBoxesAtCoordinates
(
FVector2D InHitLocation, |
Finds all the hitboxes containing the given coordinates. | GameFramework/HUD.h | |
const FHUDHitBox * GetHitBoxWithName
(
const FName InName |
Return the hitbox with the given name | GameFramework/HUD.h | |
APawn * GetOwningPawn() |
Returns the Pawn for this HUD's player. | GameFramework/HUD.h |
|
APlayerController * GetOwningPlayerController() |
Returns the PlayerController for this HUD's player. | GameFramework/HUD.h |
|
| Returns the width and height of a string. | GameFramework/HUD.h |
|
|
virtual void HandleBugScreenShot() |
Gives the HUD a chance to display project-specific data when taking a "bug" screen shot. | GameFramework/HUD.h | |
virtual void NextDebugTarget() |
Cycle to next target in our considered targets list for 'showdebug' | GameFramework/HUD.h |
|
virtual void NotifyBindPostProcessEffects() |
Called in PostInitializeComponents or postprocessing chain has changed (happens because of the worldproperties can define it's own chain and this one is set late). | GameFramework/HUD.h | |
virtual void NotifyHitBoxBeginCursorOver
(
FName BoxName |
Native handler, called when a hit box is moused over. | GameFramework/HUD.h | |
virtual void NotifyHitBoxClick
(
FName BoxName |
Native handler, called when a hit box is clicked on. Provides the name associated with that box. | GameFramework/HUD.h | |
virtual void NotifyHitBoxEndCursorOver
(
FName BoxName |
Native handler, called when a hit box no longer has the mouse over it. | GameFramework/HUD.h | |
virtual void NotifyHitBoxRelease
(
FName BoxName |
Native handler, called when a hit box is unclicked. Provides the name associated with that box. | GameFramework/HUD.h | |
virtual void OnLostFocusPause
(
bool bEnable |
Pauses or unpauses the game due to main window's focus being lost. | GameFramework/HUD.h | |
virtual void PostRender() |
PostRender is the main draw loop. | GameFramework/HUD.h | |
virtual void PreviousDebugTarget() |
Cycle to previous target in our considered targets list for 'showdebug' | GameFramework/HUD.h |
|
FVector Project
(
FVector Location, |
Transforms a 3D world-space vector into 2D screen coordinates | GameFramework/HUD.h |
|
void ReceiveDrawHUD
(
int32 SizeX, |
Hook to allow blueprints to do custom HUD drawing. | GameFramework/HUD.h |
|
void ReceiveHitBoxBeginCursorOver
(
const FName BoxName |
Called when a hit box is moused over. | GameFramework/HUD.h |
|
void ReceiveHitBoxClick
(
const FName BoxName |
Called when a hit box is clicked on. Provides the name associated with that box. | GameFramework/HUD.h |
|
void ReceiveHitBoxEndCursorOver
(
const FName BoxName |
Called when a hit box no longer has the mouse over it. | GameFramework/HUD.h |
|
void ReceiveHitBoxRelease
(
const FName BoxName |
Called when a hit box is unclicked. Provides the name associated with that box. | GameFramework/HUD.h |
|
void RemoveAllDebugStrings() |
Remove all debug strings added via AddDebugText | GameFramework/HUD.h |
|
void RemoveDebugText
(
AActor* SrcActor, |
Remove debug strings for the given actor | GameFramework/HUD.h |
|
virtual void RemovePostRenderedActor
(
AActor* A |
Remove an actor from the PostRenderedActors array | GameFramework/HUD.h | |
void RenderHitBoxes
(
FCanvas* InCanvas |
Debug renderer for this frames hitboxes. | GameFramework/HUD.h | |
| Set the canvas and debug canvas to use during drawing | GameFramework/HUD.h | ||
virtual bool ShouldDisplayDebug
(
const FName& DebugType |
Check if we should be display debug information for particular types of debug messages. | GameFramework/HUD.h | |
virtual void ShowDebug
(
FName DebugType |
Toggles displaying properties of player's current ViewTarget DebugType input values supported by base engine include "AI", "physics", "net", "camera", and "collision" | GameFramework/HUD.h |
|
void ShowDebugForReticleTargetToggle
(
TSubclassOf< AActor > DesiredClass |
Toggles 'ShowDebug' from showing debug info between reticle target actor (of subclass |
GameFramework/HUD.h |
|
virtual void ShowDebugInfo
(
float& YL, |
Entry point for basic debug rendering on the HUD. | GameFramework/HUD.h | |
void ShowDebugToggleSubCategory
(
FName Category |
Toggles sub categories of show debug to customize display | GameFramework/HUD.h |
|
virtual void ShowHUD() |
Hides or shows HUD | GameFramework/HUD.h |
|
bool UpdateAndDispatchHitBoxClickEvents
(
const FVector2D ClickLocation, |
Update the list of hitboxes and dispatch events for any hits. | GameFramework/HUD.h | |
void UpdateHitBoxCandidates
(
TArray< FVector2D > InContactPoints |
Update a the list of hitboxes that have been hit this frame. | GameFramework/HUD.h |
Overridden from AActor
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostInitializeComponents() |
Allow actors to initialize themselves on the C++ side after all of their components have been initialized, only called during gameplay | GameFramework/HUD.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool IsCanvasValid_WarnIfNot() |
GameFramework/HUD.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Utility function to add an actor to our consideration list for 'showdebug' Only consider visible, non destroyed Actors in the same world the player is in. | GameFramework/HUD.h | ||
static void AddComponentOwnerToDebugList
(
UActorComponent* InComponent, |
Utility function to add a component's owner to our consideration list for 'showdebug' | GameFramework/HUD.h |