// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Subsystems/GameInstanceSubsystem.h" #include "SubtitleDisplayOptions.h" #include "SubtitleDisplaySubsystem.generated.h" #define UE_API GAMESUBTITLES_API class FSubsystemCollectionBase; class ULocalPlayer; class UObject; USTRUCT(BlueprintType) struct FSubtitleFormat { GENERATED_BODY() public: FSubtitleFormat() : SubtitleTextSize(ESubtitleDisplayTextSize::Medium) , SubtitleTextColor(ESubtitleDisplayTextColor::White) , SubtitleTextBorder(ESubtitleDisplayTextBorder::None) , SubtitleBackgroundOpacity(ESubtitleDisplayBackgroundOpacity::Medium) { } public: UPROPERTY(EditAnywhere, Category = "Display Info") ESubtitleDisplayTextSize SubtitleTextSize; UPROPERTY(EditAnywhere, Category = "Display Info") ESubtitleDisplayTextColor SubtitleTextColor; UPROPERTY(EditAnywhere, Category = "Display Info") ESubtitleDisplayTextBorder SubtitleTextBorder; UPROPERTY(EditAnywhere, Category = "Display Info") ESubtitleDisplayBackgroundOpacity SubtitleBackgroundOpacity; }; UCLASS(MinimalAPI, DisplayName = "Subtitle Display") class USubtitleDisplaySubsystem : public UGameInstanceSubsystem { GENERATED_BODY() public: DECLARE_EVENT_OneParam(USubtitleDisplaySubsystem, FDisplayFormatChangedEvent, const FSubtitleFormat& /*DisplayFormat*/); FDisplayFormatChangedEvent DisplayFormatChangedEvent; public: static UE_API USubtitleDisplaySubsystem* Get(const ULocalPlayer* LocalPlayer); public: UE_API USubtitleDisplaySubsystem(); // Begin USubsystem UE_API virtual void Initialize(FSubsystemCollectionBase& Collection) override; UE_API virtual void Deinitialize() override; // End USubsystem UE_API void SetSubtitleDisplayOptions(const FSubtitleFormat& InOptions); UE_API const FSubtitleFormat& GetSubtitleDisplayOptions() const; private: UPROPERTY() FSubtitleFormat SubtitleFormat; }; #undef UE_API