Manage all Assets with ContentManager

This commit is contained in:
Simon Lübeß
2025-02-16 01:02:41 +01:00
parent 25e1c53a08
commit 49c3e93e08
10 changed files with 57 additions and 33 deletions
+6 -1
View File
@@ -22,7 +22,7 @@ abstract class Asset : RefCounter
public StringView Identifier
{
get => _identifier;
internal set => _identifier.Set(value);
set => _identifier.Set(value);
}
/// If true the asset is completely loaded. If false it is only partially loaded (if at all).
@@ -40,6 +40,11 @@ abstract class Asset : RefCounter
((.)new => AssetSerialize, new => AssetDeserialize));
}
protected this()
{
Content.ManageAsset(this);
}
protected ~this()
{
// TODO: crash when _contentManager is deleted first...
+2 -2
View File
@@ -99,7 +99,7 @@ namespace GlitchyEngine.Content
var contentManager;
if (contentManager == null)
contentManager = Application.Get().ContentManager;
contentManager = Application.Instance.ContentManager;
Asset asset = contentManager.GetAsset(typeof(T), handle, blocking);
@@ -124,7 +124,7 @@ namespace GlitchyEngine.Content
var contentManager;
if (contentManager == null)
contentManager = Application.Get().ContentManager;
contentManager = Application.Instance.ContentManager;
return contentManager.ManageAsset(asset);
}