Asset loading structure complete.

Loads information from loader.
information creates useable.
Minor folder restructuring.
Untested.
This commit is contained in:
2020-04-17 22:09:13 -05:00
parent 9c19b21ffb
commit d50ede989c
8 changed files with 123 additions and 10 deletions

View File

@@ -0,0 +1,9 @@
using System;
namespace RecrownedGTK.AssetsSystem.Information {
public interface IInfo
{
Type type {get;}
IDisposable CreateUseable();
}
}

View File

@@ -0,0 +1,14 @@
namespace RecrownedGTK.AssetsSystem.Information {
public struct NinePatchInfo {
public int leftBound, rightBound, bottomBound, topBound;
public string name;
public NinePatchInfo(string name, int leftBound, int rightBound, int bottomBound, int topBound) {
this.leftBound = leftBound;
this.rightBound = rightBound;
this.bottomBound = bottomBound;
this.topBound = topBound;
this.name = name;
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using RecrownedGTK.Graphics;
namespace RecrownedGTK.AssetsSystem.Information {
public struct TextureInfo : IInfo {
public string name;
public byte[] textureData;
int width, height;
public Type type => typeof(TextureData);
public TextureInfo(string name, int width, int height, byte[] textureData) {
this.name = name;
this.width = width;
this.height = height;
this.textureData = textureData;
}
public IDisposable CreateUseable()
{
TextureData data = new TextureData(textureData, width, height);
return data;
}
}
}

View File

@@ -0,0 +1,32 @@
using RecrownedGTK.Types;
namespace RecrownedGTK.AssetsSystem.Information {
public struct TextureMapInfo {
public string pathToMap;
public MapRegionInfo[] regionInfos;
public TextureMapInfo(string pathToMap, params MapRegionInfo[] regionInfos) {
this.pathToMap = pathToMap;
this.regionInfos = regionInfos;
}
public struct MapRegionInfo {
public string name;
public NinePatchInfo ninePatchInfo;
public int x, y, width, height;
public MapRegionInfo(string name, int x, int y, int width, int height, NinePatchInfo ninePatchInfo = default(NinePatchInfo)) {
this.name = name;
this.ninePatchInfo = ninePatchInfo;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public void SetBounds(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
}
}