diff --git a/MLEM.Extended/Font/GenericBitmapFont.cs b/MLEM.Extended/Font/GenericBitmapFont.cs
new file mode 100644
index 0000000..17cd34e
--- /dev/null
+++ b/MLEM.Extended/Font/GenericBitmapFont.cs
@@ -0,0 +1,53 @@
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using MLEM.Font;
+using MonoGame.Extended.BitmapFonts;
+
+namespace MLEM.Extended.Font {
+ public class GenericBitmapFont : IGenericFont {
+
+ public readonly BitmapFont Font;
+
+ public GenericBitmapFont(BitmapFont font) {
+ this.Font = font;
+ }
+
+ public static implicit operator GenericBitmapFont(BitmapFont font) {
+ return new GenericBitmapFont(font);
+ }
+
+ public Vector2 MeasureString(string text) {
+ return this.Font.MeasureString(text);
+ }
+
+ public Vector2 MeasureString(StringBuilder text) {
+ return this.Font.MeasureString(text);
+ }
+
+ public void DrawString(SpriteBatch batch, string text, Vector2 position, Color color) {
+ batch.DrawString(this.Font, text, position, color);
+ }
+
+ public void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) {
+ batch.DrawString(this.Font, text, position, color, rotation, origin, scale, effects, layerDepth);
+ }
+
+ public void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) {
+ batch.DrawString(this.Font, text, position, color, rotation, origin, scale, effects, layerDepth);
+ }
+
+ public void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color) {
+ batch.DrawString(this.Font, text, position, color);
+ }
+
+ public void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) {
+ batch.DrawString(this.Font, text, position, color, rotation, origin, scale, effects, layerDepth);
+ }
+
+ public void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) {
+ batch.DrawString(this.Font, text, position, color, rotation, origin, scale, effects, layerDepth);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/MLEM.Extended/MLEM.Extended.csproj b/MLEM.Extended/MLEM.Extended.csproj
index 78937f3..c9fe245 100644
--- a/MLEM.Extended/MLEM.Extended.csproj
+++ b/MLEM.Extended/MLEM.Extended.csproj
@@ -14,13 +14,15 @@
-
+
+ all
+
all
-
+
\ No newline at end of file
diff --git a/MLEM.Ui/Anchor.cs b/MLEM.Ui/Anchor.cs
new file mode 100644
index 0000000..ddf3cb7
--- /dev/null
+++ b/MLEM.Ui/Anchor.cs
@@ -0,0 +1,21 @@
+namespace MLEM.Ui {
+ public enum Anchor {
+
+ TopLeft,
+ TopCenter,
+ TopRight,
+ CenterLeft,
+ Center,
+ CenterRight,
+ BottomLeft,
+ BottomCenter,
+ BottomRight,
+
+ AutoLeft, // below older sibling, aligned to the left
+ AutoCenter, // below older sibling, aligned to the center
+ AutoRight, //below older sibling, aligned to the right
+ AutoInline, // right of older sibling or below if overflows
+ AutoInlineIgnoreOverflow // right of older sibling at all time
+
+ }
+}
\ No newline at end of file
diff --git a/MLEM.Ui/MLEM.Ui.csproj b/MLEM.Ui/MLEM.Ui.csproj
index c4b8c3a..b4eacc3 100644
--- a/MLEM.Ui/MLEM.Ui.csproj
+++ b/MLEM.Ui/MLEM.Ui.csproj
@@ -14,7 +14,6 @@
-
all
diff --git a/MLEM/Extensions/SpriteBatchExtensions.cs b/MLEM/Extensions/SpriteBatchExtensions.cs
index 0462cc0..95bfb67 100644
--- a/MLEM/Extensions/SpriteBatchExtensions.cs
+++ b/MLEM/Extensions/SpriteBatchExtensions.cs
@@ -10,6 +10,12 @@ namespace MLEM.Extensions {
if (blankTexture == null) {
blankTexture = new Texture2D(batch.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
blankTexture.SetData(new[] {Color.White});
+ batch.Disposing += (sender, args) => {
+ if (blankTexture != null) {
+ blankTexture.Dispose();
+ blankTexture = null;
+ }
+ };
}
return blankTexture;
}
diff --git a/MLEM/Font/GenericSpriteFont.cs b/MLEM/Font/GenericSpriteFont.cs
new file mode 100644
index 0000000..2eb4c00
--- /dev/null
+++ b/MLEM/Font/GenericSpriteFont.cs
@@ -0,0 +1,51 @@
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace MLEM.Font {
+ public class GenericSpriteFont : IGenericFont {
+
+ public readonly SpriteFont Font;
+
+ public GenericSpriteFont(SpriteFont font) {
+ this.Font = font;
+ }
+
+ public static implicit operator GenericSpriteFont(SpriteFont font) {
+ return new GenericSpriteFont(font);
+ }
+
+ public Vector2 MeasureString(string text) {
+ return this.Font.MeasureString(text);
+ }
+
+ public Vector2 MeasureString(StringBuilder text) {
+ return this.Font.MeasureString(text);
+ }
+
+ public void DrawString(SpriteBatch batch, string text, Vector2 position, Color color) {
+ batch.DrawString(this.Font, text, position, color);
+ }
+
+ public void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) {
+ batch.DrawString(this.Font, text, position, color, rotation, origin, scale, effects, layerDepth);
+ }
+
+ public void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) {
+ batch.DrawString(this.Font, text, position, color, rotation, origin, scale, effects, layerDepth);
+ }
+
+ public void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color) {
+ batch.DrawString(this.Font, text, position, color);
+ }
+
+ public void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) {
+ batch.DrawString(this.Font, text, position, color, rotation, origin, scale, effects, layerDepth);
+ }
+
+ public void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) {
+ batch.DrawString(this.Font, text, position, color, rotation, origin, scale, effects, layerDepth);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/MLEM/Font/IGenericFont.cs b/MLEM/Font/IGenericFont.cs
new file mode 100644
index 0000000..f4414e4
--- /dev/null
+++ b/MLEM/Font/IGenericFont.cs
@@ -0,0 +1,25 @@
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace MLEM.Font {
+ public interface IGenericFont {
+
+ Vector2 MeasureString(string text);
+
+ Vector2 MeasureString(StringBuilder text);
+
+ void DrawString(SpriteBatch batch, string text, Vector2 position, Color color);
+
+ void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth);
+
+ void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth);
+
+ void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color);
+
+ void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth);
+
+ void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth);
+
+ }
+}
\ No newline at end of file