Merge branch 'WES-XX-GPU-Test' into 'development'

Wes xx gpu test

See merge request wesign/unity-application!106
This commit was merged in pull request #106.
This commit is contained in:
Jerome Coudron
2023-05-14 19:41:40 +00:00
10 changed files with 1118 additions and 14 deletions

View File

@@ -326,6 +326,27 @@ public class PersistentDataController
public MinigameIndex currentMinigame;
public CourseIndex currentCourse;
public ThemeIndex currentTheme;
/// <summary>
/// The use hardware acceleration user preferences
/// </summary>
public bool useGPU = false;
/// <summary>
/// Initiate the SavedDataStructure, by setting the user preferences
/// </summary>
public SavedDataStructure()
{
RestoreSettings();
}
/// <summary>
/// Reset the user preferences to the default values
/// </summary>
public void RestoreSettings()
{
useGPU = false;
}
}
/// <summary>
@@ -364,6 +385,7 @@ public class PersistentDataController
{
json.users.Clear();
json.currentUser = -1;
json.useGPU = false;
}
/// <summary>
@@ -539,4 +561,37 @@ public class PersistentDataController
if (save)
Save();
}
/// <summary>
/// Whether the user wants to use hardware acceleration or not
/// </summary>
public bool IsUsingGPU()
{
return json.useGPU;
}
/// <summary>
/// Set the preference of the user for hardware acceleration
/// </summary>
/// <param name="value">Value of the preference</param>
/// <param name="save">Whether to save the change immediately to disk</param>
public void SetGPUUsage(bool value, bool save = true)
{
json.useGPU = value;
if (save)
Save();
}
/// <summary>
/// Restore preferences to default factory settings
/// </summary>
/// <param name="save">Whether to save the change immediately to disk</param>
public void RestoreSettings(bool save = true)
{
json.RestoreSettings();
if (save)
Save();
}
}