diff --git a/src/Menu/GameMenu.cs b/src/Menu/GameMenu.cs index fb1e5f6..0229991 100644 --- a/src/Menu/GameMenu.cs +++ b/src/Menu/GameMenu.cs @@ -140,7 +140,7 @@ namespace Cthangover.Mods.Interface.Menu private void OnExitClick() { - GetTree().Quit(); + Cthangover.Core.Bootstrap.ApplicationExit.Quit(GetTree()); } } } diff --git a/src/Tool/ToolMenuButton.cs b/src/Tool/ToolMenuButton.cs deleted file mode 100644 index 3a78020..0000000 --- a/src/Tool/ToolMenuButton.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Godot; -using Cthangover.Core.UI.Tool; - -namespace Cthangover.Mods.Interface.Tool -{ - /// - /// Shared factory for the launcher buttons that tools contribute to the main - /// menu's tool block. Keeps the standard presentation (localized caption), - /// the translation-key metadata used for live language switching, and the - /// window-opening action in one place, so - /// implementations stay focused while remaining free to append extra controls. - /// - public static class ToolMenuButton - { - /// - /// Creates a button labelled with the tool's , - /// wires it to open a fresh window via , and adds - /// it to . Returns the created button so a tool can - /// decorate it further (icon, tooltip, extra handlers). - /// - public static Button Attach(Container container, IToolProvider tool) - { - var button = new Button - { - Text = TranslationServer.Translate(tool.LocaleKey), - }; - button.SetMeta(Menu.MenuBuilder.LocaleMetaKey, tool.LocaleKey); - button.Pressed += () => ToolWindow.ShowWindow(tool.CreateWindow()); - container.AddChild(button); - return button; - } - } -} diff --git a/src/View/ViewportCapture.cs b/src/View/ViewportCapture.cs index f211a3f..732e68b 100644 --- a/src/View/ViewportCapture.cs +++ b/src/View/ViewportCapture.cs @@ -23,6 +23,7 @@ namespace Cthangover.Mods.Interface.View if (image == null || !viewport.UseHdr2D) return image; + using var source = image; image.Convert(Image.Format.Rgbaf); var floats = MemoryMarshal.Cast(image.GetData()); var bytes = new byte[floats.Length]; @@ -39,7 +40,7 @@ namespace Cthangover.Mods.Interface.View /// Saves the current frame of as a PNG; false without a frame. public static bool SavePng(Viewport viewport, string path) { - var image = Take(viewport); + using var image = Take(viewport); return image != null && image.SavePng(path) == Error.Ok; } }