Files
gig-line/Game/GigLine/Source/GigLine/GigLineHUD.cpp
T
zwitschi 3a1db78473 qa: package + document controls (0.1.0 release check PASS) (#18)
Merged PR #18: package + document controls

Co-authored-by: Zwitschi <zwitschi82@gmail.com>
2026-11-08 15:22:34 +01:00

41 lines
1.4 KiB
C++

#include "GigLineHUD.h"
#include "Engine/Canvas.h"
#include "Engine/Engine.h"
void AGigLineHUD::DrawHUD()
{
Super::DrawHUD();
if (!Canvas || AttributionLine.IsEmpty())
{
return;
}
// Bottom-left, above any letterbox: the standard place for map/data credits.
const float LineHeight = Canvas->ClipY > 0 ? 22.0f * TextScale : 22.0f * TextScale;
const float X = MarginPx;
const float Y = Canvas->ClipY - MarginPx - LineHeight * 2.1f;
const FLinearColor Shadow(0.0f, 0.0f, 0.0f, 0.55f);
const FLinearColor Ink(1.0f, 1.0f, 1.0f, 0.92f);
// Shadow pass for legibility over bright pavement and sky.
DrawText(AttributionLine, Shadow, X + 1.0f, Y + 1.0f, nullptr, TextScale);
DrawText(LicenceLine, Shadow, X + 1.0f, Y + LineHeight + 1.0f, nullptr, TextScale * 0.82f);
DrawText(AttributionLine, Ink, X, Y, nullptr, TextScale);
DrawText(LicenceLine, Ink, X, Y + LineHeight, nullptr, TextScale * 0.82f);
// Control legend, bottom-right (0.1.0 release check: controls shown in-game).
if (!ControlsLine.IsEmpty())
{
float IgnoredW = 0.0f, ControlsH = 0.0f;
GetTextSize(ControlsLine, IgnoredW, ControlsH, nullptr, TextScale * 0.82f);
const float CX = Canvas->ClipX - MarginPx - IgnoredW;
const float CY = Canvas->ClipY - MarginPx - ControlsH;
DrawText(ControlsLine, Shadow, CX + 1.0f, CY + 1.0f, nullptr, TextScale * 0.82f);
DrawText(ControlsLine, Ink, CX, CY, nullptr, TextScale * 0.82f);
}
}