public DebugUiSystem(IMainWindow mainWindow, RenderingDevice device) { _device = device; // This is used for IME only. var hwnd = IntPtr.Zero; if (mainWindow is MainWindow realMainWindow) { hwnd = realMainWindow.NativeHandle; } var context = device.Device.ImmediateContext; var guiContext = ImGui.CreateContext(); ImGui.SetCurrentContext(guiContext); ImGui.GetIO().Fonts.AddFontDefault(); AddRobotoFonts(); _renderer = new ImGuiRenderer(); if (!_renderer.ImGui_ImplDX11_Init(hwnd, device.Device, context)) { throw new Exception("Unable to initialize IMGui!"); } mainWindow.SetWindowMsgFilter(HandleMessage); }