Wes xx gpu test

This commit is contained in:
Jelle De Geest
2023-05-14 19:41:37 +00:00
committed by Jerome Coudron
parent 1cceb3cb89
commit 1f5b855f61
10 changed files with 1118 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.UI;
public class SettingsScreen : MonoBehaviour
{
@@ -8,11 +9,44 @@ public class SettingsScreen : MonoBehaviour
/// </summary>
public PlayableDirector directorEnterFromMainMenu;
/// <summary>
/// Reference to the 'hardware acceleration' toggle option
/// </summary>
public Toggle useGPUOption;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
useGPUOption.onValueChanged.AddListener(ToggleGPU);
UpdateSettings();
directorEnterFromMainMenu.Play();
}
/// <summary>
/// Update the display of the user preferences
/// </summary>
private void UpdateSettings()
{
var pdc = PersistentDataController.GetInstance();
useGPUOption.isOn = pdc.IsUsingGPU();
}
/// <summary>
/// Toggle 'hardware acceleration' option
/// </summary>
private void ToggleGPU(bool state)
{
PersistentDataController.GetInstance().SetGPUUsage(state);
}
/// <summary>
/// Restore the user preferences to their default values
/// </summary>
public void RestoreSettings()
{
PersistentDataController.GetInstance().RestoreSettings();
UpdateSettings();
}
}