WindowsWindow now calls DestroyWindow

This commit is contained in:
Simon Lübeß
2020-12-30 14:48:37 +01:00
parent 9a010f7c4a
commit a02b781347
@@ -158,12 +158,21 @@ namespace GlitchyEngine
Init(desc); Init(desc);
} }
[LinkName(.C)]
static extern Windows.IntBool DestroyWindow(Windows.HWnd hWnd);
[LinkName("UnregisterClassW")] [LinkName("UnregisterClassW")]
static extern Windows.IntBool UnregisterClass(char16* className, Windows.HInstance hInstance); static extern Windows.IntBool UnregisterClass(char16* className, Windows.HInstance hInstance);
public ~this() public ~this()
{ {
if(!DestroyWindow(_windowHandle))
{
HResult res = (.)GetLastError();
Log.EngineLogger.Error($"Failed to destroy window: Message ({(int)res}): {res}");
}
UnregisterClass(WindowClassName.ToScopedNativeWChar!(), _instanceHandle); UnregisterClass(WindowClassName.ToScopedNativeWChar!(), _instanceHandle);
} }