Language:
Discover
By Skill Level
By Category

AHUD::DrawText

Choose your OS:

Syntax

void DrawText
(
    const FString & Text,
    FLinearColor TextColor,
    float ScreenX,
    float ScreenY,
    UFont * Font,
    float Scale,
    bool bScalePosition
)

Remarks

Draws a string on the HUD.

Parameters

Parameter

Description

Text

String to draw

TextColor

Color to draw string

ScreenX

Screen-space X coordinate of upper left corner of the string.

ScreenY

Screen-space Y coordinate of upper left corner of the string.

Font

Font to draw text. If NULL, default font is chosen.

Scale

Scale multiplier to control size of the text.

bScalePosition

Whether the "Scale" parameter should also scale the position of this draw call.

Example Code

MyHud.cpp at line 26:

        // Calculate ratio from 720p  
        const float HUDXRatio = Canvas->SizeX / 1280.f;  
        const float HUDYRatio = Canvas->SizeY / 720.f;  

        FLinearColor TextColor = FColor::White;  
        float ScreenX = 32.0f;  
        float ScreenY = 32.0f;  
        FVector2D ScaleVec(HUDYRatio * 1.4f, HUDYRatio * 1.4f);  

        if( CoordinatesText.IsEmpty() == false )  
        {  
            const float TextScale = 1.0f;  
            const bool bDontScale = false;  
            DrawText(CoordinatesText, TextColor, ScreenX, ScreenY, HUDFont, TextScale, bDontScale);  
        }

References

Module

Engine

Header

Runtime/Engine/Classes/GameFramework/HUD.h

Source

Runtime/Engine/Private/HUD.cpp