diff --git a/RhythmBullet/Content/Content.mgcb b/RhythmBullet/Content/Content.mgcb
index a33bd27..17747f9 100644
--- a/RhythmBullet/Content/Content.mgcb
+++ b/RhythmBullet/Content/Content.mgcb
@@ -601,21 +601,6 @@
/processorParam:TextureFormat=Color
/build:3840x2160/void_circle.png
-#begin fonts/darktech_ldr.ttf
-/importer:
-/processor:
-/build:fonts/darktech_ldr.ttf
-
-#begin fonts/Gasalt-Regular.ttf
-/importer:
-/processor:
-/build:fonts/Gasalt-Regular.ttf
-
-#begin fonts/maiden.TTF
-/importer:
-/processor:
-/build:fonts/maiden.TTF
-
#begin sfx/disintegrate.ogg
/importer:OggImporter
/processor:SongProcessor
@@ -705,3 +690,23 @@
/processorParam:TextureFormat=Color
/build:splash_texture.png
+#begin fonts/darktech_ldr.spritefont
+/importer:FontDescriptionImporter
+/processor:FontDescriptionProcessor
+/processorParam:PremultiplyAlpha=True
+/processorParam:TextureFormat=Compressed
+/build:fonts/darktech_ldr.spritefont
+
+#begin fonts/gasalt_regular.spritefont
+/importer:FontDescriptionImporter
+/processor:FontDescriptionProcessor
+/processorParam:PremultiplyAlpha=True
+/processorParam:TextureFormat=Compressed
+/build:fonts/gasalt_regular.spritefont
+
+#begin fonts/iron_maiden.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:fonts/iron_maiden.fx
+
diff --git a/RhythmBullet/Content/fonts/darktech_ldr.spritefont b/RhythmBullet/Content/fonts/darktech_ldr.spritefont
new file mode 100644
index 0000000..bd33ecf
--- /dev/null
+++ b/RhythmBullet/Content/fonts/darktech_ldr.spritefont
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+ Arial
+
+
+ 12
+
+
+ 0
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+ ~
+
+
+
+
diff --git a/RhythmBullet/Content/fonts/gasalt_regular.spritefont b/RhythmBullet/Content/fonts/gasalt_regular.spritefont
new file mode 100644
index 0000000..bd33ecf
--- /dev/null
+++ b/RhythmBullet/Content/fonts/gasalt_regular.spritefont
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+ Arial
+
+
+ 12
+
+
+ 0
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+ ~
+
+
+
+
diff --git a/RhythmBullet/Content/fonts/Gasalt-Regular.ttf b/RhythmBullet/Content/fonts/gasalt_regular.ttf
similarity index 100%
rename from RhythmBullet/Content/fonts/Gasalt-Regular.ttf
rename to RhythmBullet/Content/fonts/gasalt_regular.ttf
diff --git a/RhythmBullet/Content/fonts/maiden.TTF b/RhythmBullet/Content/fonts/iron_maiden.TTF
similarity index 100%
rename from RhythmBullet/Content/fonts/maiden.TTF
rename to RhythmBullet/Content/fonts/iron_maiden.TTF
diff --git a/RhythmBullet/Content/fonts/iron_maiden.fx b/RhythmBullet/Content/fonts/iron_maiden.fx
new file mode 100644
index 0000000..a1c6941
--- /dev/null
+++ b/RhythmBullet/Content/fonts/iron_maiden.fx
@@ -0,0 +1,46 @@
+#if OPENGL
+ #define SV_POSITION POSITION
+ #define VS_SHADERMODEL vs_3_0
+ #define PS_SHADERMODEL ps_3_0
+#else
+ #define VS_SHADERMODEL vs_4_0_level_9_1
+ #define PS_SHADERMODEL ps_4_0_level_9_1
+#endif
+
+matrix WorldViewProjection;
+
+struct VertexShaderInput
+{
+ float4 Position : POSITION0;
+ float4 Color : COLOR0;
+};
+
+struct VertexShaderOutput
+{
+ float4 Position : SV_POSITION;
+ float4 Color : COLOR0;
+};
+
+VertexShaderOutput MainVS(in VertexShaderInput input)
+{
+ VertexShaderOutput output = (VertexShaderOutput)0;
+
+ output.Position = mul(input.Position, WorldViewProjection);
+ output.Color = input.Color;
+
+ return output;
+}
+
+float4 MainPS(VertexShaderOutput input) : COLOR
+{
+ return input.Color;
+}
+
+technique BasicColorDrawing
+{
+ pass P0
+ {
+ VertexShader = compile VS_SHADERMODEL MainVS();
+ PixelShader = compile PS_SHADERMODEL MainPS();
+ }
+};
\ No newline at end of file
diff --git a/RhythmBullet/RhythmBullet.csproj b/RhythmBullet/RhythmBullet.csproj
index 7f8a48b..7d18707 100644
--- a/RhythmBullet/RhythmBullet.csproj
+++ b/RhythmBullet/RhythmBullet.csproj
@@ -49,7 +49,7 @@
-
+
diff --git a/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentLoad.cs b/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentLoad.cs
new file mode 100644
index 0000000..5f20794
--- /dev/null
+++ b/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentLoad.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
+{
+ class ContentLoad
+ {
+ internal Type type;
+ internal string assetName;
+
+ public ContentLoad(string assetName, Type type)
+ {
+ this.type = type;
+ this.assetName = assetName;
+ }
+ }
+}
diff --git a/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentLoader.cs b/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentLoader.cs
deleted file mode 100644
index 5aed6cf..0000000
--- a/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentLoader.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
-{
- class ContentLoader
- {
- }
-}
diff --git a/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentSystem.cs b/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentSystem.cs
index ef988e1..1624a80 100644
--- a/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentSystem.cs
+++ b/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentSystem.cs
@@ -3,38 +3,88 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
{
class ContentSystem
{
- private readonly ContentManager contentManager;
- private readonly Queue> queue;
- private Dictionary assets;
+ Thread thread;
+ internal volatile bool loading;
+ readonly ContentManager contentManager;
+ readonly Queue queue;
+ Dictionary assets;
readonly Dictionary contentResolver;
public ContentSystem(ContentManager contentManager)
{
this.contentManager = contentManager;
assets = new Dictionary();
- queue = new Queue>();
+ queue = new Queue();
contentResolver = new Dictionary();
}
- void Load(string assetName, Type type)
+ private void Load(string assetName, Type type)
{
- if (assets.ContainsKey(assetName))
+ IContentResolver handler = contentResolver[type];
+ string path = handler.Load(assetName);
+ assets.Add(assetName, contentManager.Load(path));
+ }
+
+ private void LoadBatch()
+ {
+ while (queue.Count != 0)
{
- IContentResolver handler = contentResolver[type];
- string path = handler.Load(assetName);
- assets.Add(assetName, contentManager.Load(path));
+ lock (queue)
+ {
+ ContentLoad content = queue.Dequeue();
+ Load(content.assetName, content.type);
+ }
}
}
- T get (string assetName)
+ T get(string assetName)
{
- return (T)assets[assetName];
+ lock(queue)
+ {
+ return (T)assets[assetName];
+ }
+ }
+
+ void Queue(string assetName, Type type)
+ {
+ lock (queue)
+ {
+ if (!assets.ContainsKey(assetName))
+ {
+ queue.Enqueue(new ContentLoad(assetName, type));
+ }
+ }
+ }
+
+ ///
+ /// Called whenever a batch of assets should be loaded from the queue. Safe to call once every frame.
+ ///
+ void Update()
+ {
+ if (queue.Count > 0)
+ {
+ if (thread == null || !thread.IsAlive)
+ {
+ ThreadStart threadStart = new ThreadStart(LoadBatch);
+ thread = new Thread(threadStart);
+ }
+ }
+ }
+
+ void UnloadAll()
+ {
+ foreach (KeyValuePair asset in assets)
+ {
+ asset.Value.Dispose();
+ assets.Remove(asset.Key);
+ }
}
}
}