diff --git a/MonoGame.Framework.arm64.dll b/MonoGame.Framework.arm64.dll new file mode 100644 index 00000000..6b0ba692 Binary files /dev/null and b/MonoGame.Framework.arm64.dll differ diff --git a/MonoGame.Framework.x64.dll b/MonoGame.Framework.x64.dll new file mode 100644 index 00000000..6b0ba692 Binary files /dev/null and b/MonoGame.Framework.x64.dll differ diff --git a/Wobble.Tests/Wobble.Tests.csproj b/Wobble.Tests/Wobble.Tests.csproj index e93d799f..a62c9ecc 100644 --- a/Wobble.Tests/Wobble.Tests.csproj +++ b/Wobble.Tests/Wobble.Tests.csproj @@ -2,6 +2,7 @@ Exe net6.0 + win-x64;linux-x64;osx-x64;osx-arm64 @@ -23,10 +24,8 @@ PreserveNewest - - - - ..\MonoGame.Framework.dll - + + ..\MonoGame.Framework.dll + \ No newline at end of file diff --git a/Wobble.Tests/WobbleTestsGame.cs b/Wobble.Tests/WobbleTestsGame.cs index 6a8a8fb2..c492b419 100644 --- a/Wobble.Tests/WobbleTestsGame.cs +++ b/Wobble.Tests/WobbleTestsGame.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; -using System.Drawing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using Wobble.Graphics; -using Wobble.Graphics.BitmapFonts; using Wobble.Graphics.Sprites; using Wobble.Graphics.Sprites.Text; using Wobble.Graphics.UI.Debugging; @@ -24,7 +22,7 @@ public class WobbleTestsGame : WobbleGame private FpsCounter FpsCounter { get; set; } - private SpriteText WaylandState { get; set; } + private SpriteTextPlus WaylandState { get; set; } public WobbleTestsGame() : base(true) { @@ -72,36 +70,30 @@ protected override void LoadContent() Resources.AddStore(new DllResourceStore("Wobble.Tests.Resources.dll")); - if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-bold")) - BitmapFontFactory.AddFont("exo2-bold", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-bold.ttf")); - - if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-regular")) - BitmapFontFactory.AddFont("exo2-regular", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-regular.ttf")); - - if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-semibold")) - BitmapFontFactory.AddFont("exo2-semibold", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-semibold.ttf")); - - if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-medium")) - BitmapFontFactory.AddFont("exo2-medium", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-medium.ttf")); + var fonts = new List { "exo2-bold", "exo2-regular", "exo2-semibold", "exo2-medium" }; + foreach (var fontName in fonts) + { + FontManager.CacheWobbleFont(fontName, new WobbleFontStore(20, GameBase.Game.Resources.Get($"Wobble.Tests.Resources/Fonts/{fontName}.ttf"))); + } - var font = new WobbleFontStore(20, GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-semibold.ttf"), new Dictionary() + var japaneseFont = new WobbleFontStore(20, GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-semibold.ttf"), new Dictionary() { {"Emoji", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/symbola-emoji.ttf")}, {"Japanese", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/droid-sans-japanese.ttf")} }); - FontManager.CacheWobbleFont("exo2-semibold", font); + FontManager.CacheWobbleFont("exo2-semibold-japanese", japaneseFont); IsReadyToUpdate = true; - FpsCounter = new FpsCounter(FontManager.LoadBitmapFont("Content/gotham"), 18) + FpsCounter = new FpsCounter(FontManager.GetWobbleFont("exo2-semibold"), 18) { Parent = GlobalUserInterface, Alignment = Alignment.BotRight, Size = new ScalableVector2(70, 30), }; - WaylandState = new SpriteText("exo2-semibold", $"Wayland: {WaylandVsync}", 18) + WaylandState = new SpriteTextPlus(FontManager.GetWobbleFont("exo2-semibold"), $"Wayland: {WaylandVsync}", 18) { Parent = GlobalUserInterface, Alignment = Alignment.BotRight, @@ -137,7 +129,7 @@ protected override void Update(GameTime gameTime) if (KeyboardManager.IsUniqueKeyPress(Keys.W) && OperatingSystem.IsLinux()) { WaylandVsync = !WaylandVsync; - WaylandState.ScheduleUpdate(() => WaylandState.Text = $"Wayland: {WaylandVsync}"); + WaylandState.Text = $"Wayland: {WaylandVsync}"; } } diff --git a/Wobble/Graphics/Sprites/Text/SpriteTextPlusLine.cs b/Wobble/Graphics/Sprites/Text/SpriteTextPlusLine.cs index 5b838e00..9334cd39 100644 --- a/Wobble/Graphics/Sprites/Text/SpriteTextPlusLine.cs +++ b/Wobble/Graphics/Sprites/Text/SpriteTextPlusLine.cs @@ -112,7 +112,10 @@ public SpriteTextPlusLine(WobbleFontStore font, string text, float size = 0) private static float GetScale() { var scale = WindowManager.ScreenScale.X; - Debug.Assert(scale > 0, "You're setting up text too early (WindowManager.ScreenScale.X is 0)."); + + // Some stuff (namely DrawableLog and the FPS counter) wants to draw text before anything is initialized. + if (scale == 0) + scale = 1; if (GameBase.Game.Graphics.PreferredBackBufferWidth < 1600) return scale * 2; diff --git a/Wobble/Graphics/UI/Debugging/FpsCounter.cs b/Wobble/Graphics/UI/Debugging/FpsCounter.cs index a46dc876..36d51d67 100644 --- a/Wobble/Graphics/UI/Debugging/FpsCounter.cs +++ b/Wobble/Graphics/UI/Debugging/FpsCounter.cs @@ -1,9 +1,9 @@ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using MonoGame.Extended.BitmapFonts; -using Wobble.Graphics.BitmapFonts; using Wobble.Graphics.Sprites; +using Wobble.Graphics.Sprites.Text; +using Wobble.Managers; namespace Wobble.Graphics.UI.Debugging { @@ -20,9 +20,9 @@ public class FpsCounter : Container private int FrameCounter { get; set; } /// - /// The SpriteText that displays the FPS value. + /// The SpriteTextPlus that displays the FPS value. /// - public SpriteTextBitmap TextFps { get; } + public SpriteTextPlus TextFps { get; } /// /// The current update rate. @@ -35,9 +35,9 @@ public class FpsCounter : Container private int UpdateCounter { get; set; } /// - /// The SpriteText that displays the UPS value. + /// The SpriteTextPlus that displays the UPS value. /// - public SpriteTextBitmap TextUps { get; } + public SpriteTextPlus TextUps { get; } /// /// The amount of time elapsed so we can begin counting each second. @@ -48,20 +48,18 @@ public class FpsCounter : Container /// /// Ctor /// - public FpsCounter(BitmapFont font, int size) + public FpsCounter(WobbleFontStore font, int size) { - TextFps = new SpriteTextBitmap(font, "0 FPS", false) + TextFps = new SpriteTextPlus(font, "0 FPS", size) { Parent = this, Alignment = Alignment.TopRight, - FontSize = size }; - TextUps = new SpriteTextBitmap(font, "0 UPS", false) + TextUps = new SpriteTextPlus(font, "0 UPS", size) { Parent = this, Alignment = Alignment.TopRight, - FontSize = size, Y = TextFps.Size.Y.Value }; } diff --git a/Wobble/Wobble.csproj b/Wobble/Wobble.csproj index dd2e6473..466cb429 100644 --- a/Wobble/Wobble.csproj +++ b/Wobble/Wobble.csproj @@ -3,6 +3,7 @@ net6.0 true 7.1 + osx-x64;osx-arm64 false @@ -17,8 +18,7 @@ - - + @@ -37,13 +37,14 @@ Always + + Always + Always - - - - ..\MonoGame.Framework.dll - + + ..\MonoGame.Framework.dll + diff --git a/Wobble/libgdiplus.dylib b/Wobble/libgdiplus.dylib new file mode 100644 index 00000000..1f025e17 Binary files /dev/null and b/Wobble/libgdiplus.dylib differ diff --git a/Wobble/libopenal.1.dylib b/Wobble/libopenal.1.dylib index 883af954..d274d84f 100644 Binary files a/Wobble/libopenal.1.dylib and b/Wobble/libopenal.1.dylib differ