pixachux c0d9450d30 Make top-down the default camera mode and bind camera toggle to C.
Matches Fantasy Life style gameplay; first-person remains available as an optional mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-22 18:55:07 +02:00

84 lines
2.2 KiB
C++

// Copyright VocationLife Project. All Rights Reserved.
#include "VocationHUD.h"
#include "VocationGraphicsLibrary.h"
#include "Engine/Canvas.h"
#include "Engine/Engine.h"
void AVocationHUD::BeginPlay()
{
Super::BeginPlay();
}
void AVocationHUD::SetInteractionPrompt(const FText& Prompt)
{
CurrentInteractionPrompt = Prompt;
}
void AVocationHUD::ClearInteractionPrompt()
{
CurrentInteractionPrompt = FText::GetEmpty();
}
void AVocationHUD::SetPauseVisible(bool bVisible)
{
bShowPauseMenu = bVisible;
}
void AVocationHUD::ShowDebugStatus(const FString& Status)
{
DebugStatusLine = Status;
}
void AVocationHUD::ApplyGraphicsPresetFromHUD(EVocationGraphicsPreset Preset, bool bRayTracing)
{
UVocationGraphicsLibrary::ApplyGraphicsPreset(Preset, bRayTracing);
}
void AVocationHUD::DrawHUD()
{
Super::DrawHUD();
DrawMainHUD();
}
void AVocationHUD::DrawMainHUD()
{
if (!Canvas)
{
return;
}
const float Scale = Canvas->ClipX / 1920.f;
const FLinearColor TextColor(1.f, 1.f, 1.f, 1.f);
if (!CurrentInteractionPrompt.IsEmpty())
{
const FString PromptString = CurrentInteractionPrompt.ToString();
float TextWidth = 0.f;
float TextHeight = 0.f;
Canvas->StrLen(GEngine->GetMediumFont(), PromptString, TextWidth, TextHeight);
Canvas->DrawColor = FColor::White;
Canvas->DrawText(GEngine->GetMediumFont(), PromptString,
(Canvas->ClipX - TextWidth) * 0.5f, Canvas->ClipY * 0.85f, 1.2f * Scale, 1.2f * Scale);
}
if (!DebugStatusLine.IsEmpty())
{
Canvas->DrawColor = FColor::Cyan;
Canvas->DrawText(GEngine->GetSmallFont(), DebugStatusLine, 40.f * Scale, 40.f * Scale, Scale, Scale);
}
if (bShowPauseMenu)
{
const FString PauseText = TEXT("PAUSED\nF1 Low | F2 Medium | F3 High | F4 Ultra | F5 Ray Tracing\nH Host | J Join | S Save");
Canvas->DrawColor = FColor::Yellow;
Canvas->DrawText(GEngine->GetMediumFont(), PauseText, Canvas->ClipX * 0.35f, Canvas->ClipY * 0.35f, Scale, Scale);
}
else
{
const FString Controls = TEXT("WASD Move | Mouse Look | C Camera | E Interact/Craft | LMB Attack | I Save | Esc Pause");
Canvas->DrawColor = FColor(200, 200, 200);
Canvas->DrawText(GEngine->GetSmallFont(), Controls, 40.f * Scale, Canvas->ClipY - 60.f * Scale, Scale, Scale);
}
}