From 66c6ceec0484585114965767628b4c74ad421f75 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 30 Sep 2022 13:03:05 -0700 Subject: [PATCH] hide main window until Game.Run is called --- src/Game.cs | 6 ++++-- src/Window.cs | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Game.cs b/src/Game.cs index 21026eb..0b9ea9f 100644 --- a/src/Game.cs +++ b/src/Game.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using SDL2; using MoonWorks.Audio; using MoonWorks.Graphics; @@ -67,7 +67,7 @@ namespace MoonWorks debugMode ); - MainWindow = new Window(windowCreateInfo, GraphicsDevice.WindowFlags); + MainWindow = new Window(windowCreateInfo, GraphicsDevice.WindowFlags | SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN); if (!GraphicsDevice.ClaimWindow(MainWindow, windowCreateInfo.PresentMode)) { @@ -79,6 +79,8 @@ namespace MoonWorks public void Run() { + MainWindow.Show(); + while (!quit) { Tick(); diff --git a/src/Window.cs b/src/Window.cs index a890650..a78eb8c 100644 --- a/src/Window.cs +++ b/src/Window.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using SDL2; @@ -92,6 +92,11 @@ namespace MoonWorks return idLookup.ContainsKey(windowID) ? idLookup[windowID] : null; } + internal void Show() + { + SDL.SDL_ShowWindow(Handle); + } + internal void SizeChanged(uint width, uint height) { Width = width;