I believe we now have a semi-working graphics profiles and the ability to switch between them!

This commit is contained in:
Jordon Brooks 2024-05-15 17:44:04 +01:00
parent b8f67c33dc
commit d4ac87e36d
Signed by: jordon
GPG key ID: DBD9758CD53E786A
3 changed files with 100 additions and 20 deletions

View file

@ -26,9 +26,6 @@ public:
UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings")
void SaveConfig() const;
UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings", meta=(bCheckForCommandLineOverrides=true))
void ApplySettings(bool bCheckForCommandLineOverrides = true);
/** Returns the game local machine settings (resolution, windowing mode, scalability settings, etc...) */
UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings")
static UHarmonyLinkGraphics* GetSettings();
@ -41,10 +38,12 @@ private:
bool LoadSection(const FConfigFile& ConfigFile, const TPair<EProfile, FName> Profile);
void SaveSection(FSettingsProfile& SettingsProfile, const bool bFlush = false) const;
void LoadDefaults();
void ApplyProfile(EProfile Profile);
bool ApplyProfile(EProfile Profile);
static void ResetInstance();
static void ApplySetting(const TPair<FName, FHLConfigValue>& Setting);
// Debugging
void DebugPrintProfiles() const;
static void PrintDebugSection(FSettingsProfile& SettingsProfile);

View file

@ -45,7 +45,24 @@ public:
FHLConfigValue(bool Value) : Type(EConfigValueType::Bool), IntValue(0), FloatValue(0.0f), BoolValue(Value), StringValue(TEXT("")) {}
FHLConfigValue(const FString& Value) : Type(EConfigValueType::String), IntValue(0), FloatValue(0.0f), BoolValue(false), StringValue(Value) {}
FString ToString() const
{
switch (Type)
{
case EConfigValueType::Int:
return FString::Printf(TEXT("Int: %d"), IntValue);
case EConfigValueType::Float:
return FString::Printf(TEXT("Float: %f"), FloatValue);
case EConfigValueType::Bool:
return BoolValue ? TEXT("Bool: true") : TEXT("Bool: false");
case EConfigValueType::String:
return FString::Printf(TEXT("String: %s"), *StringValue);
default:
return TEXT("Unknown Type");
}
}
EConfigValueType GetType() const
{
return Type;