aboutsummaryrefslogtreecommitdiff
path: root/source/resources/Resources.cs
diff options
context:
space:
mode:
authorhazel <hazel@hazelthats.me>2026-01-26 22:04:39 +0100
committerhazel <hazel@hazelthats.me>2026-01-26 22:04:39 +0100
commit567c422f8cd42eba2437f9a8c2522716a1649be7 (patch)
tree93c5b296f3b7c14b626d0aadf5cad37764c41c74 /source/resources/Resources.cs
downloadcelesteia-567c422f8cd42eba2437f9a8c2522716a1649be7.tar.gz
celesteia-567c422f8cd42eba2437f9a8c2522716a1649be7.tar.bz2
celesteia-567c422f8cd42eba2437f9a8c2522716a1649be7.zip
celesteia archive, last updated april 9th 2024
Signed-off-by: hazel <hazel@hazelthats.me>
Diffstat (limited to 'source/resources/Resources.cs')
-rw-r--r--source/resources/Resources.cs81
1 files changed, 81 insertions, 0 deletions
diff --git a/source/resources/Resources.cs b/source/resources/Resources.cs
new file mode 100644
index 0000000..d200764
--- /dev/null
+++ b/source/resources/Resources.cs
@@ -0,0 +1,81 @@
+using System.Collections.Generic;
+using Celesteia.Resources.Management;
+using Celesteia.Resources.Types;
+using Microsoft.Xna.Framework.Content;
+
+namespace Celesteia.Resources {
+ public static class ResourceManager {
+ public static ItemManager Items = new ItemManager();
+ public static BlockManager Blocks = new BlockManager();
+ public static RecipeManager Recipes = new RecipeManager();
+ public static EntityManager Entities = new EntityManager();
+ public static FontTypes Fonts = new FontTypes();
+ public static SkyboxAssets Skybox = new SkyboxAssets();
+
+ public const float SPRITE_SCALING = 0.125f;
+ public const int INVERSE_SPRITE_SCALING = 8;
+
+ public static void AddCollection(IResourceCollection collection) {
+ Blocks.AddCollection(collection);
+ Items.AddCollection(collection);
+ Recipes.AddCollection(collection);
+ Entities.AddCollection(collection);
+ }
+
+ public static void LoadContent(ContentManager content) {
+ Blocks.LoadContent(content);
+ Items.LoadContent(content);
+ Recipes.LoadContent(content);
+ Entities.LoadContent(content);
+
+ Fonts.LoadContent(content);
+ Skybox.LoadContent(content);
+ }
+ }
+
+ public struct NamespacedKey {
+ public readonly string Namespace;
+ public readonly string Index;
+
+ public NamespacedKey(string ns, string index) {
+ Namespace = ns;
+ Index = index;
+ }
+
+ public static NamespacedKey Base(string index) {
+ return new NamespacedKey("celesteia", index);
+ }
+
+ public string Qualify() {
+ return $"{Namespace}:{Index}";
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj is NamespacedKey && ((NamespacedKey)obj).Namespace == Namespace && ((NamespacedKey)obj).Index == Index;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+ public interface IResourceType {
+ public byte GetID();
+ public void SetID(byte id);
+ }
+
+ public interface IResourceManager {
+ public void AddCollection(IResourceCollection collection);
+ public IResourceType GetResource(NamespacedKey namespacedKey);
+ }
+
+ public interface IResourceCollection {
+ public Dictionary<NamespacedKey, BlockType> GetBlocks();
+ public Dictionary<NamespacedKey, ItemType> GetItems();
+ public Dictionary<NamespacedKey, Recipe> GetRecipes();
+ public Dictionary<NamespacedKey, EntityType> GetEntities();
+ public NamespacedKey GetKey(string index);
+ }
+} \ No newline at end of file