diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 2e759294a3..636a04e1c1 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -496,7 +496,7 @@ namespace OpenRA Renderer.InitializeDepthBuffer(grid); Cursor?.Dispose(); - Cursor = new CursorManager(ModData.CursorProvider); + Cursor = new CursorManager(ModData.CursorProvider, ModData.Manifest.CursorSheetSize); var metadata = ModData.Manifest.Metadata; if (!string.IsNullOrEmpty(metadata.WindowTitle)) diff --git a/OpenRA.Game/Graphics/CursorManager.cs b/OpenRA.Game/Graphics/CursorManager.cs index eec5b2d64c..8c7e480183 100644 --- a/OpenRA.Game/Graphics/CursorManager.cs +++ b/OpenRA.Game/Graphics/CursorManager.cs @@ -39,12 +39,12 @@ namespace OpenRA.Graphics readonly bool hardwareCursorsDisabled = false; bool hardwareCursorsDoubled = false; - public CursorManager(CursorProvider cursorProvider) + public CursorManager(CursorProvider cursorProvider, int cursorSheetSize) { hardwareCursorsDisabled = Game.Settings.Graphics.DisableHardwareCursors; graphicSettings = Game.Settings.Graphics; - sheetBuilder = new SheetBuilder(SheetType.BGRA, 512); + sheetBuilder = new SheetBuilder(SheetType.BGRA, cursorSheetSize); // Sort the cursors for better packing onto the sheet. foreach (var kv in cursorProvider.Cursors diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index 632d4f5ee7..9f8b183938 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -74,7 +74,9 @@ namespace OpenRA public readonly string[] SpriteFormats = Array.Empty(); public readonly string[] PackageFormats = Array.Empty(); public readonly string[] VideoFormats = Array.Empty(); - public bool AllowUnusedTranslationsInExternalPackages = true; + public readonly bool AllowUnusedTranslationsInExternalPackages = true; + public readonly int FontSheetSize = 512; + public readonly int CursorSheetSize = 512; readonly string[] reservedModuleNames = { @@ -82,7 +84,7 @@ namespace OpenRA "Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons", "Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions", "Hotkeys", "ServerTraits", "LoadScreen", "DefaultOrderGenerator", "SupportsMapsFrom", "SoundFormats", "SpriteFormats", "VideoFormats", - "RequiresMods", "PackageFormats", "AllowUnusedTranslationsInExternalPackages" + "RequiresMods", "PackageFormats", "AllowUnusedTranslationsInExternalPackages", "FontSheetSize", "CursorSheetSize" }; readonly TypeDictionary modules = new(); @@ -171,6 +173,12 @@ namespace OpenRA if (yaml.TryGetValue("AllowUnusedTranslationsInExternalPackages", out entry)) AllowUnusedTranslationsInExternalPackages = FieldLoader.GetValue("AllowUnusedTranslationsInExternalPackages", entry.Value); + + if (yaml.TryGetValue("FontSheetSize", out entry)) + FontSheetSize = FieldLoader.GetValue("FontSheetSize", entry.Value); + + if (yaml.TryGetValue("CursorSheetSize", out entry)) + CursorSheetSize = FieldLoader.GetValue("CursorSheetSize", entry.Value); } public void LoadCustomData(ObjectCreator oc) diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index 73b5863bc8..9c111b4e1c 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -133,7 +133,7 @@ namespace OpenRA using (new PerfTimer("SpriteFonts")) { fontSheetBuilder?.Dispose(); - fontSheetBuilder = new SheetBuilder(SheetType.BGRA, 512); + fontSheetBuilder = new SheetBuilder(SheetType.BGRA, modData.Manifest.FontSheetSize); Fonts = modData.Manifest.Get().FontList.ToDictionary(x => x.Key, x => new SpriteFont( platform, x.Value.Font, modData.DefaultFileSystem.Open(x.Value.Font).ReadAllBytes(),