public async Task Start() { _cancellationTokenSource = new CancellationTokenSource(); var totalScreen = _screenInformation.ScreenArea; _renderThread = new Thread(() => { _window = new Sdl2Window( "Overlay", totalScreen.X, totalScreen.Y, totalScreen.Width, totalScreen.Height, SDL_WindowFlags.Borderless | SDL_WindowFlags.AlwaysOnTop | SDL_WindowFlags.SkipTaskbar, false); _gd = VeldridStartup.CreateDefaultD3D11GraphicsDevice( new GraphicsDeviceOptions(false, null, true), _window); _cl = _gd.ResourceFactory.CreateCommandList(); _controller = new ImGuiController( _gd, _gd.MainSwapchain.Framebuffer.OutputDescription, _window.Width, _window.Height); _window.Resized += () => { _gd.MainSwapchain.Resize((uint)_window.Width, (uint)_window.Height); _controller.WindowResized(_window.Width, _window.Height); }; Visible = true; _window.Closing += () => { }; WindowsNativeMethods.InitTransparency(_window.Handle); SetClickAbility(false); ThreadIsReady = true; MainLoop(_cancellationTokenSource.Token); }) { IsBackground = true }; _renderThread.Start(); await SpinWait(() => ThreadIsReady); }
protected void SetClickAbility(bool clickable) { WindowsNativeMethods.SetOverlayClickable(_window.Handle, clickable); }
protected void SetVisibility(bool visible) { WindowsNativeMethods.SetWindowVisibility(_window.Handle, visible); }