38 lines
806 B
C++
38 lines
806 B
C++
// Project Lab - NHTV Igad
|
|
|
|
#include "UnrealProject.h"
|
|
#include "Prefs.h"
|
|
|
|
#define PREFS_SLOT_NAME TEXT("WIEBERPREFS tm")
|
|
|
|
UPrefs::UPrefs(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
useControllerName = "";
|
|
|
|
musicVolume = 1.0f;
|
|
sfxVolume = 1.0f;
|
|
|
|
while (customGraphicsSettings.Num() < 6)
|
|
customGraphicsSettings.Add(3);
|
|
|
|
usingCustomGraphicsSettings = false;
|
|
}
|
|
|
|
UPrefs* UPrefs::Load()
|
|
{
|
|
UPrefs* settings = Cast<UPrefs>(UGameplayStatics::LoadGameFromSlot(PREFS_SLOT_NAME, 0));
|
|
if (!settings)
|
|
{
|
|
settings = Cast<UPrefs>(UGameplayStatics::CreateSaveGameObject(UPrefs::StaticClass()));
|
|
}
|
|
check(settings);
|
|
|
|
return settings;
|
|
}
|
|
|
|
void UPrefs::Save(UPrefs* settings)
|
|
{
|
|
UGameplayStatics::SaveGameToSlot(settings, PREFS_SLOT_NAME, 0);
|
|
}
|