lyra_game_ue/Source/LyraGame/UI/PerformanceStats/LyraPerfStatWidgetBase.h
Goran Lazarevski 3bcab085f8 Initial commit
2025-03-20 11:06:26 +01:00

49 lines
1.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CommonUserWidget.h"
#include "LyraPerfStatWidgetBase.generated.h"
enum class ELyraDisplayablePerformanceStat : uint8;
class ULyraPerformanceStatSubsystem;
class UObject;
struct FFrame;
/**
* ULyraPerfStatWidgetBase
*
* Base class for a widget that displays a single stat, e.g., FPS, ping, etc...
*/
UCLASS(Abstract)
class ULyraPerfStatWidgetBase : public UCommonUserWidget
{
public:
ULyraPerfStatWidgetBase(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
GENERATED_BODY()
public:
// Returns the stat this widget is supposed to display
UFUNCTION(BlueprintPure)
ELyraDisplayablePerformanceStat GetStatToDisplay() const
{
return StatToDisplay;
}
// Polls for the value of this stat (unscaled)
UFUNCTION(BlueprintPure)
double FetchStatValue();
protected:
// Cached subsystem pointer
UPROPERTY(Transient)
TObjectPtr<ULyraPerformanceStatSubsystem> CachedStatSubsystem;
// The stat to display
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Display)
ELyraDisplayablePerformanceStat StatToDisplay;
};