Lesson 56 - API Test HUD

This commit is contained in:
Norman Lansing
2026-03-26 21:38:50 -04:00
parent f093212884
commit 0fecdf2df7
10 changed files with 112 additions and 21 deletions

View File

@@ -18,7 +18,8 @@ public class DedicatedServers : ModuleRules
PrivateDependencyModuleNames.AddRange(new string[]
{
"Slate",
"SlateCore",
"SlateCore",
"UMG"
});
// Adds in the plugin for GameLiftServerSDK if it is the server build.

View File

@@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UI/APITest/APITestHUD.h"
#include "UI/APITest/APITestOverlay.h"
void AAPITestHUD::BeginPlay()
{
Super::BeginPlay();
APlayerController* PlayerController = GetOwningPlayerController();
if (IsValid(PlayerController) && APITestOverlayClass)
{
APITestOverlay = CreateWidget<UAPITestOverlay>(PlayerController, APITestOverlayClass);
APITestOverlay->AddToViewport();
}
}

View File

@@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UI/APITest/APITestOverlay.h"

View File

@@ -0,0 +1,31 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
class UAPITestOverlay;
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "APITestHUD.generated.h"
/**
*
*/
UCLASS()
class DEDICATEDSERVERS_API AAPITestHUD : public AHUD
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly)
TSubclassOf<UAPITestOverlay> APITestOverlayClass;
protected:
virtual void BeginPlay() override;
private:
UPROPERTY()
TObjectPtr<UAPITestOverlay> APITestOverlay;
};

View File

@@ -0,0 +1,16 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "APITestOverlay.generated.h"
/**
*
*/
UCLASS()
class DEDICATEDSERVERS_API UAPITestOverlay : public UUserWidget
{
GENERATED_BODY()
};