Expose the default font and cursor sheet size settings to mod.yaml
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -74,7 +74,9 @@ namespace OpenRA
|
||||
public readonly string[] SpriteFormats = Array.Empty<string>();
|
||||
public readonly string[] PackageFormats = Array.Empty<string>();
|
||||
public readonly string[] VideoFormats = Array.Empty<string>();
|
||||
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<bool>("AllowUnusedTranslationsInExternalPackages", entry.Value);
|
||||
|
||||
if (yaml.TryGetValue("FontSheetSize", out entry))
|
||||
FontSheetSize = FieldLoader.GetValue<int>("FontSheetSize", entry.Value);
|
||||
|
||||
if (yaml.TryGetValue("CursorSheetSize", out entry))
|
||||
CursorSheetSize = FieldLoader.GetValue<int>("CursorSheetSize", entry.Value);
|
||||
}
|
||||
|
||||
public void LoadCustomData(ObjectCreator oc)
|
||||
|
||||
@@ -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<Fonts>().FontList.ToDictionary(x => x.Key,
|
||||
x => new SpriteFont(
|
||||
platform, x.Value.Font, modData.DefaultFileSystem.Open(x.Value.Font).ReadAllBytes(),
|
||||
|
||||
Reference in New Issue
Block a user