Files
mod_menu_base/test_suites/display_settings/src/DisplaySettingsTestInitializer.cs
T
cthangover 9bd0483af9 Settings menu: display settings, language codes, style guide window
Display tab: window mode (windowed/maximized/borderless/exclusive), monitor, window
size per monitor (centred, disabled in fullscreen), V-Sync, frame rate cap, reset;
applied and saved at once through the core DisplaySettingsService. Language is read
through LanguageCode (en-en/en_US = English). The window follows the style guide
shell: title and tabs in the header, close on the right, footer hint and per-tab reset.
The main menu hides every session panel of UiHost (pause menu stayed above it).
New suite display_settings (+ --shots); collection_edit leaves the game through the
pause menu and checks it is closed.
2026-10-21 19:18:34 +02:00

34 lines
1.1 KiB
C#

using System.Linq;
using Cthangover.Core.Mods;
using Cthangover.Core.Utils;
using Godot;
namespace Mods.DisplaySettingsTest
{
/// <summary>Queues <see cref="DisplaySettingsTestDriverNode"/> only for <c>--itest=display_settings</c>; <c>--shots=&lt;dir&gt;</c> makes it save screenshots of the menu and every settings tab.</summary>
public class DisplaySettingsTestInitializer : IModInitializer
{
private static bool queued;
public void OnModLoaded(string modId) { }
public void OnModResourcesReady()
{
var args = OS.GetCmdlineUserArgs();
if (queued || !args.Contains("--itest=display_settings"))
return;
string shots = null;
foreach (var arg in args)
{
if (arg.StartsWith("--shots="))
shots = arg.Substring("--shots=".Length);
}
queued = true;
GameLogger.Log("TEST", "DisplaySettingsTest: activating");
(Godot.Engine.GetMainLoop() as SceneTree)?.Root?.CallDeferred("add_child", new DisplaySettingsTestDriverNode(shots));
}
}
}