Lession 56 - API Test HUD

This commit is contained in:
Norman Lansing
2026-03-15 09:19:39 -04:00
parent f52a4225c3
commit 898fba8153
9 changed files with 70 additions and 3 deletions

View File

@@ -2,8 +2,8 @@
CommonUI.Debug.CheckGameViewportClientValid=0 CommonUI.Debug.CheckGameViewportClientValid=0
[/Script/EngineSettings.GameMapsSettings] [/Script/EngineSettings.GameMapsSettings]
GameDefaultMap=/Game/ThirdPerson/Maps/ThirdPersonMap.ThirdPersonMap GameDefaultMap=/Game/Maps/StartupMap.StartupMap
EditorStartupMap=/Game/ThirdPerson/Maps/ThirdPersonMap.ThirdPersonMap EditorStartupMap=/Game/Maps/StartupMap.StartupMap
GlobalDefaultGameMode=/Game/Blueprints/Game/BP_ShooterGameModeBase.BP_ShooterGameModeBase_C GlobalDefaultGameMode=/Game/Blueprints/Game/BP_ShooterGameModeBase.BP_ShooterGameModeBase_C
ServerDefaultMap=/Game/ThirdPerson/Maps/ThirdPersonMap.ThirdPersonMap ServerDefaultMap=/Game/ThirdPerson/Maps/ThirdPersonMap.ThirdPersonMap

View File

@@ -21,7 +21,8 @@ public class DedicatedServers : ModuleRules
{ {
"Slate", "Slate",
"SlateCore", "SlateCore",
"OpenSSL" "OpenSSL",
"UMG"
}); });
// Adds in the plugin for GameLiftServerSDK if it is the server build. // Adds in the plugin for GameLiftServerSDK if it is the server build.

View File

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

View File

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

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()
};

View File

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