wait for directx initialization before constructing game due to keen static constructors calling render
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 49s
Build / Build Nuget package (SharedCringe) (push) Successful in 55s
Build / Build Nuget package (CringePlugins) (push) Successful in 1m5s
Build / Build Nuget package (NuGet) (push) Successful in 1m20s
Build / Build Launcher (push) Successful in 1m41s
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 49s
Build / Build Nuget package (SharedCringe) (push) Successful in 55s
Build / Build Nuget package (CringePlugins) (push) Successful in 1m5s
Build / Build Nuget package (NuGet) (push) Successful in 1m20s
Build / Build Launcher (push) Successful in 1m41s
This commit is contained in:
@@ -125,6 +125,8 @@ public class Launcher : ICorePlugin
|
|||||||
|
|
||||||
_lifetime.RegisterLifetime();
|
_lifetime.RegisterLifetime();
|
||||||
|
|
||||||
|
WaitForDevice();
|
||||||
|
|
||||||
_game = new(args)
|
_game = new(args)
|
||||||
{
|
{
|
||||||
GameRenderComponent = _renderComponent,
|
GameRenderComponent = _renderComponent,
|
||||||
@@ -138,6 +140,24 @@ public class Launcher : ICorePlugin
|
|||||||
|
|
||||||
public void Run() => _game?.Run();
|
public void Run() => _game?.Run();
|
||||||
|
|
||||||
|
private void WaitForDevice()
|
||||||
|
{
|
||||||
|
if (_renderComponent!.RenderThread.CurrentSettings.DRSSettingsPresets is not null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var resetEvent = new ManualResetEventSlim(false);
|
||||||
|
|
||||||
|
void RenderThreadOnSizeChanged(int width, int height, MyViewport viewport)
|
||||||
|
{
|
||||||
|
_renderComponent.RenderThread.SizeChanged -= RenderThreadOnSizeChanged;
|
||||||
|
resetEvent.Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderComponent.RenderThread.SizeChanged += RenderThreadOnSizeChanged;
|
||||||
|
|
||||||
|
resetEvent.Wait();
|
||||||
|
}
|
||||||
|
|
||||||
private IVRageWindow InitEarlyWindow(Splash splash)
|
private IVRageWindow InitEarlyWindow(Splash splash)
|
||||||
{
|
{
|
||||||
ImGuiHandler.Instance = new();
|
ImGuiHandler.Instance = new();
|
||||||
@@ -148,8 +168,7 @@ public class Launcher : ICorePlugin
|
|||||||
|
|
||||||
MyVRage.Platform.Windows.Window.OnExit += MySandboxGame.ExitThreadSafe;
|
MyVRage.Platform.Windows.Window.OnExit += MySandboxGame.ExitThreadSafe;
|
||||||
|
|
||||||
_renderComponent!.RenderThread.UpdateSize();
|
MyRenderProxy.RenderThread = _renderComponent!.RenderThread;
|
||||||
MyRenderProxy.RenderThread = _renderComponent.RenderThread;
|
|
||||||
|
|
||||||
MyVRage.Platform.Windows.Window.ShowAndFocus();
|
MyVRage.Platform.Windows.Window.ShowAndFocus();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user