/// <summary> /// Infinite While Loop to render the ImGui. /// </summary> private void WhileLoop() { while (window.Exists) { if (requireResize) { Sdl2Native.SDL_SetWindowPosition(window.SdlWindowHandle, (int)futurePos.X, (int)futurePos.Y); Sdl2Native.SDL_SetWindowSize(window.SdlWindowHandle, (int)futureSize.X, (int)futureSize.Y); window.PumpEvents(); continue; } if (!window.Visible) { window.PumpEvents(); Thread.Sleep(10); continue; } if (!window.Exists) { break; } imController.InitlizeFrame(1f / myFps); this.SubmitUI?.Invoke(this, new EventArgs()); commandList.Begin(); commandList.SetFramebuffer(graphicsDevice.MainSwapchain.Framebuffer); commandList.ClearColorTarget(0, new RgbaFloat(clearColor.X, clearColor.Y, clearColor.Z, clearColor.W)); imController.Render(graphicsDevice, commandList); commandList.End(); graphicsDevice.SubmitCommands(commandList); graphicsDevice.SwapBuffers(graphicsDevice.MainSwapchain); } }