Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/GameFramework
Inheritance Hierarchy
References
| Module | Engine |
| Header | /Engine/Source/Runtime/Engine/Classes/GameFramework/HUD.h |
| Include | #include "GameFramework/HUD.h" |
Syntax
class AHUD : public AActor
Remarks
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.
Variables
| Type | Name | Description | |
|---|---|---|---|
| uint8: 1 | bEnableDebugTextShadow | Put shadow on debug strings | |
| uint8: 1 | bLostFocusPaused | Tells whether the game was paused due to lost focus | |
| uint8: 1 | bShowDebugInfo | If true, current ViewTarget shows debug information using its DisplayDebug(). | |
| uint8: 1 | bShowHitBoxDebugInfo | If true, show hitbox debugging info. | |
| uint8: 1 | bShowHUD | Whether or not the HUD should be drawn. | |
| uint8: 1 | bShowOverlays | If true, render actor overlays. | |
| TObjectPtr< UCanvas > | Canvas | Canvas to Draw HUD on. | |
| int32 | CurrentTargetIndex | Current target in our considered Targets list for 'showdebug' | |
| TObjectPtr< UCanvas > | DebugCanvas | 'Foreground' debug canvas, will draw in front of SlateUI. | |
| TArray< FName > | DebugDisplay | Array of names specifying what debug info to display for viewtarget actor. | |
| TArray< struct FDebugTextInfo > | DebugTextList | List of debug strings attached to actors, sorted by actor first, then by order of addition | |
| TSet< FName > | HitBoxesOver | Set of hitbox (by name) that are currently moused over or have a touch contacting them | |
| TArray< FHUDHitBox * > | HitBoxHits | Array of hitboxes that have been hit for this frame. | |
| TArray< FHUDHitBox > | HitBoxMap | Array of hitboxes for this frame. | |
| float | LastHUDRenderTime | Used to calculate delta time between HUD rendering. | |
| TObjectPtr< APlayerController > | PlayerOwner | PlayerController which owns this HUD. | |
| TArray< TObjectPtr< AActor > > | PostRenderedActors | Holds a list of Actors that need PostRender() calls. | |
| float | RenderDelta | Time since last HUD render. | |
| TObjectPtr< AActor > | ShowDebugTargetActor | Show Debug Actor used if 'bShowDebugForReticleTarget' is true, only updated if trace from reticle hit a new Actor of class 'ShowDebugTargetDesiredClass' | |
| TSubclassOf< AActor > | ShowDebugTargetDesiredClass | Class filter for selecting 'ShowDebugTargetActor' when 'bShowDebugForReticleTarget' is true. | |
| TArray< FName > | ToggledDebugCategories | Array of names specifying what subsets of debug info to display for viewtarget actor. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
AHUD
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddActorToDebugList
(
AActor* InActor, |
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. | |
| void | AddComponentOwnerToDebugList
(
UActorComponent* InComponent, |
Utility function to add a component's owner to our consideration list for 'showdebug' | |
| void | AddDebugText
(
const FString& DebugText, |
Add debug text for a specific actor to be displayed via DrawDebugTextList(). | |
| void | Add a hitbox to the hud | ||
| void | AddPostRenderedActor
(
AActor* A |
Add an actor to the PostRenderedActors array | |
| bool | Have any hitboxes been hit this frame. | ||
| void | Deproject
(
float ScreenX, |
Transforms a 2D screen location into a 3D location and direction | |
| void | Draw2DLine
(
int32 X1, |
Draws a colored line between two points | |
| void | Draw3DLine
(
FVector Start, |
Draws a colored line between two points | |
| void | DrawActorOverlays
(
FVector Viewpoint, |
Draw overlays for actors that were rendered this tick and have added themselves to the PostRenderedActors array | |
| void | Iterate through list of debug text and draw it over the associated actors in world space. | ||
| void | DrawHUD () |
The Main Draw loop for the hud. Gets called before any messaging. Should be subclassed | |
| void | DrawLine
(
float StartScreenX, |
Draws a 2D line on the HUD. | |
| void | DrawMaterial
(
UMaterialInterface* Material, |
Draws a material-textured quad on the HUD. | |
| void | DrawMaterialSimple
(
UMaterialInterface* Material, |
Draws a material-textured quad on the HUD. Assumes UVs such that the entire material is shown. | |
| void | DrawMaterialTriangle
(
UMaterialInterface* Material, |
||
| void | DrawRect
(
FLinearColor RectColor, |
Draws a colored untextured quad on the HUD. | |
| void | Draw the safe zone debugging overlay when enabled | ||
| void | DrawText
(
const FString& Text, |
Draws a string on the HUD. | |
| void | DrawTexture
(
UTexture* Texture, |
Draws a textured quad on the HUD. | |
| void | DrawTextureSimple
(
UTexture* Texture, |
Draws a textured quad on the HUD. Assumes 1:1 texel density. | |
| bool | GetActorsInSelectionRectangle
(
const FVector2D& FirstPoint, |
Returns the array of actors inside a selection rectangle, with a class filter. | |
| void | GetActorsInSelectionRectangle
(
TSubclassOf< AActor > ClassFilter, |
Returns the array of actors inside a selection rectangle, with a class filter. | |
| AActor * | Get Target to view 'showdebug' on | ||
| void | GetDebugActorList
(
TArray< AActor* >& InOutList |
Get list of considered targets for 'showdebug' This list is built contextually based on which 'showdebug' flags have been enabled. | |
| UFont * | GetFontFromSizeIndex
(
int32 FontSizeIndex |
Messaging. | |
| const FHUDHitBox * | GetHitBoxAtCoordinates
(
FVector2D InHitLocation, |
Find the first hitbox containing the given coordinates. | |
| void | GetHitBoxesAtCoordinates
(
FVector2D InHitLocation, |
Finds all the hitboxes containing the given coordinates. | |
| const FHUDHitBox * | GetHitBoxWithName
(
const FName InName |
Return the hitbox with the given name | |
| APawn * | Returns the Pawn for this HUD's player. | ||
| APlayerController * | Returns the PlayerController for this HUD's player. | ||
| void | GetTextSize
(
const FString& Text, |
Returns the width and height of a string. | |
| void | Gives the HUD a chance to display project-specific data when taking a "bug" screen shot. | ||
| bool | |||
| void | Cycle to next target in our considered targets list for 'showdebug' | ||
| void | 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). | ||
| void | NotifyHitBoxBeginCursorOver
(
FName BoxName |
Native handler, called when a hit box is moused over. | |
| void | NotifyHitBoxClick
(
FName BoxName |
Native handler, called when a hit box is clicked on. Provides the name associated with that box. | |
| void | NotifyHitBoxEndCursorOver
(
FName BoxName |
Native handler, called when a hit box no longer has the mouse over it. | |
| void | NotifyHitBoxRelease
(
FName BoxName |
Native handler, called when a hit box is unclicked. Provides the name associated with that box. | |
| void | OnLostFocusPause
(
bool bEnable |
Pauses or unpauses the game due to main window's focus being lost. | |
| void | PostRender () |
PostRender is the main draw loop. | |
| void | Cycle to previous target in our considered targets list for 'showdebug' | ||
| FVector | Project
(
FVector Location, |
Transforms a 3D world-space vector into 2D screen coordinates | |
| void | ReceiveDrawHUD
(
int32 SizeX, |
Hook to allow blueprints to do custom HUD drawing. | |
| void | ReceiveHitBoxBeginCursorOver
(
const FName BoxName |
Called when a hit box is moused over. | |
| void | ReceiveHitBoxClick
(
const FName BoxName |
Called when a hit box is clicked on. Provides the name associated with that box. | |
| void | ReceiveHitBoxEndCursorOver
(
const FName BoxName |
Called when a hit box no longer has the mouse over it. | |
| void | ReceiveHitBoxRelease
(
const FName BoxName |
Called when a hit box is unclicked. Provides the name associated with that box. | |
| void | Remove all debug strings added via AddDebugText | ||
| void | RemoveDebugText
(
AActor* SrcActor, |
Remove debug strings for the given actor | |
| void | RemovePostRenderedActor
(
AActor* A |
Remove an actor from the PostRenderedActors array | |
| void | RenderHitBoxes
(
FCanvas* InCanvas |
Debug renderer for this frames hitboxes. | |
| void | Set the canvas and debug canvas to use during drawing | ||
| bool | ShouldDisplayDebug
(
const FName& DebugType |
Check if we should be display debug information for particular types of debug messages. | |
| void | Toggles displaying properties of player's current ViewTarget DebugType input values supported by base engine include "AI", "physics", "net", "camera", and "collision" | ||
| void | ShowDebugForReticleTargetToggle
(
TSubclassOf< AActor > DesiredClass |
Toggles 'ShowDebug' from showing debug info between reticle target actor (of subclass |
|
| void | ShowDebugInfo
(
float& YL, |
Entry point for basic debug rendering on the HUD. | |
| void | ShowDebugToggleSubCategory
(
FName Category |
Toggles sub categories of show debug to customize display | |
| void | ShowHUD () |
Hides or shows HUD | |
| bool | UpdateAndDispatchHitBoxClickEvents
(
const FVector2D ClickLocation, |
Update the list of hitboxes and dispatch events for any hits. | |
| void | UpdateHitBoxCandidates
(
TArray< FVector2D > InContactPoints |
Update a the list of hitboxes that have been hit this frame. |
Overridden from AActor
| Type | Name | Description | |
|---|---|---|---|
| void | Allow actors to initialize themselves on the C++ side after all of their components have been initialized, only called during gameplay |
Constants
| Name | Description |
|---|---|
| OnHUDPostRender | Called from ::PostRender. For less player/actor centered debugging. |
| OnShowDebugInfo | Callback allowing external systems to register to show debug info. |