Make ResourceManager a part of Game.

This commit is contained in:
2024-08-22 20:41:31 +02:00
parent 3c9019e37a
commit c61a12d170
4 changed files with 40 additions and 15 deletions

View File

@@ -1,8 +1,20 @@
using Voile.Resources;
namespace Voile
{
public abstract class Game
{
/// <summary>
/// The ResourceManager associated with this game.
/// </summary>
protected ResourceManager ResourceManager { get; private set; }
public abstract string ResourceRoot { get; }
public virtual string EngineConfigPath => "engine.config";
public Game()
{
ResourceManager = new ResourceManager();
}
/// <summary>
/// Starts the game application.
@@ -10,6 +22,8 @@ namespace Voile
/// </summary>
public void Start()
{
Configure();
Initialize();
LoadResources();
Ready();
@@ -37,5 +51,10 @@ namespace Voile
/// Called when the application quits and it's safe to clean up.
/// </summary>
public abstract void Shutdown();
private void Configure()
{
ResourceManager.ResourceRoot = ResourceRoot;
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Voile.Utils;