Add standalone win64 release packaging, Forgejo release script, and borderless/focus UX

This commit is contained in:
Meta Vens 2026-12-05 20:14:38 +01:00
commit 385275f130
12 changed files with 698 additions and 84 deletions

View file

@ -135,6 +135,7 @@ public partial class Main : Node3D
public override void _Ready()
{
ClientAssets.EnsureAssetsRootRegistered();
GetViewport().UseTaa = true;
_atmosphere = new AtmosphereSystem { Name = "AtmosphereSystem" };
AddChild(_atmosphere);
@ -310,6 +311,14 @@ public partial class Main : Node3D
}
_menuPreviewOut = System.Environment.GetEnvironmentVariable("RTD_MENU_PREVIEW_OUT");
bool hasWindowOverride = GetCliArg("--windowed", allowBareFlag: true) is not null
|| GetCliArg("--resolution") is not null
|| GetCliArg("-w", allowBareFlag: true) is not null;
if (!IsAutomatedRun && !hasWindowOverride)
{
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
}
bool perfCombat = _perfTargetFrames > 0 && System.Environment.GetEnvironmentVariable("RTD_PERF_COMBAT") == "1";
bool skipInitialDrop = InitialSkipDropOverride || perfCombat;
bool autoBypassMenu = InitialMapKindOverride.HasValue
@ -888,10 +897,56 @@ public partial class Main : Node3D
SyncMouseMode();
}
private bool IsAutomatedRun =>
DisplayServer.GetName() == "headless"
|| _perfTargetFrames > 0
|| _menuPreviewTargetFrames > 0
|| !string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("RTD_PERF_FRAMES"))
|| !string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("RTD_AUTO_EXIT_FRAMES"))
|| !string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("RTD_MENU_EXIT_FRAMES"));
public override void _Notification(int what)
{
if (what == NotificationApplicationFocusOut || what == NotificationWMWindowFocusOut)
{
Input.MouseMode = Input.MouseModeEnum.Visible;
}
else if (what == NotificationApplicationFocusIn || what == NotificationWMWindowFocusIn)
{
if (IsInsideTree())
{
SyncMouseMode();
}
}
}
private void ToggleBorderlessFullscreen()
{
if (DisplayServer.GetName() == "headless")
{
return;
}
var mode = DisplayServer.WindowGetMode();
if (mode == DisplayServer.WindowMode.Fullscreen || mode == DisplayServer.WindowMode.ExclusiveFullscreen)
{
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed);
}
else
{
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
}
}
private void SyncMouseMode()
{
if (DisplayServer.GetName() == "headless" || _perfTargetFrames > 0)
if (IsAutomatedRun)
{
Input.MouseMode = Input.MouseModeEnum.Visible;
return;
}
if (!IsInsideTree() || GetWindow() is not { } win || !win.HasFocus())
{
Input.MouseMode = Input.MouseModeEnum.Visible;
return;
}
if (_screenMode != ClientScreenMode.InMatch)
@ -1017,6 +1072,16 @@ public partial class Main : Node3D
{
if (@event is InputEventKey key && key.Pressed && !key.Echo)
{
bool isAltEnter = (key.Keycode == Key.Enter || key.Keycode == Key.KpEnter)
&& key.AltPressed && !key.CtrlPressed && !key.ShiftPressed;
bool isF11 = key.Keycode == Key.F11 && !key.AltPressed && !key.CtrlPressed && !key.ShiftPressed;
if (isAltEnter || isF11)
{
ToggleBorderlessFullscreen();
GetViewport().SetInputAsHandled();
return;
}
if (_screenMode == ClientScreenMode.MainMenu)
{
if (key.Keycode == Key.Escape && _mainMenu.IsHostPanelOpen)