blaster/Source/Blaster/HUD/BlasterHUD.h

70 lines
1.5 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "BlasterHUD.generated.h"
USTRUCT(BlueprintType)
struct FHUDPackage
{
GENERATED_BODY()
public:
UTexture2D* CrosshairsCenter;
UTexture2D* CrosshairsLeft;
UTexture2D* CrosshairsRight;
UTexture2D* CrosshairsTop;
UTexture2D* CrosshairsBottom;
float CrosshairSpread;
FLinearColor CrosshairsColor;
};
/**
*
*/
UCLASS()
class BLASTER_API ABlasterHUD : public AHUD
{
GENERATED_BODY()
public:
virtual void DrawHUD() override;
void AddCharacterOverlay();
void AddAnnouncement();
void AddDebugWidget();
UPROPERTY(EditAnywhere, Category = "Player Stats")
TSubclassOf<class UUserWidget> CharacterOverlayClass;
UPROPERTY()
class UCharacterOverlay* CharacterOverlay;
UPROPERTY()
class UDebugWidget* DebugWidget;
UPROPERTY(EditAnywhere, Category = "Widget")
TSubclassOf<class UUserWidget> DebugWidgetClass;
UPROPERTY(EditAnywhere, Category = "Announcements")
TSubclassOf<class UUserWidget> AnnouncementClass;
UPROPERTY()
class UAnnouncement* Announcement;
protected:
virtual void BeginPlay() override;
private:
FHUDPackage HUDPackage;
void DrawCrosshair(UTexture2D* Texture, FVector2D ViewportCenter, FVector2D Spread, FLinearColor CrosshairColor);
UPROPERTY(EditAnywhere)
float CrosshairSpreadMax = 16.f;
public:
FORCEINLINE void SetHUDPackage(const FHUDPackage& Package) { HUDPackage = Package; };
};