hide main window until Game.Run is called

pull/28/head
cosmonaut 2022-09-30 13:03:05 -07:00
parent dfddc24d0e
commit 66c6ceec04
2 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using SDL2; using SDL2;
using MoonWorks.Audio; using MoonWorks.Audio;
using MoonWorks.Graphics; using MoonWorks.Graphics;
@ -67,7 +67,7 @@ namespace MoonWorks
debugMode 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)) if (!GraphicsDevice.ClaimWindow(MainWindow, windowCreateInfo.PresentMode))
{ {
@ -79,6 +79,8 @@ namespace MoonWorks
public void Run() public void Run()
{ {
MainWindow.Show();
while (!quit) while (!quit)
{ {
Tick(); Tick();

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using SDL2; using SDL2;
@ -92,6 +92,11 @@ namespace MoonWorks
return idLookup.ContainsKey(windowID) ? idLookup[windowID] : null; return idLookup.ContainsKey(windowID) ? idLookup[windowID] : null;
} }
internal void Show()
{
SDL.SDL_ShowWindow(Handle);
}
internal void SizeChanged(uint width, uint height) internal void SizeChanged(uint width, uint height)
{ {
Width = width; Width = width;