protected new void Draw(GameTime gameTime) { orig_Draw(gameTime); ImGuiState.NewFrame(gameTime); ImGuiLayout(); ImGuiState.Render(); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); if (!FinishedLoading) { return; } GraphicsDevice.PrepareStencilRead(CompareFunction.Always, StencilMask.None); GraphicsDevice.PrepareStencilWrite(StencilMask.None); if (RT == null || RT.Width != GraphicsDevice.PresentationParameters.BackBufferWidth || RT.Height != GraphicsDevice.PresentationParameters.BackBufferHeight ) { if (RT != null) { RT.Dispose(); } RT = new RenderTarget2D( GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents ); } RenderTargetBinding[] prevRT = FNAHooks.PrevRenderTargets; GraphicsDevice.SetRenderTarget(RT); GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; GraphicsDevice.Clear(Color.Transparent); // NewFrame in ModGUIPreHost.Draw ImGuiLayout(); bool mouseInImGui = ImGui.IsMouseHoveringAnyWindow() || ImGui.IO.WantCaptureMouse; bool keyboardInImGui = ImGui.IO.WantCaptureKeyboard || ImGui.IO.WantTextInput; Game.IsMouseVisible &= mouseInImGui; if (MouseState is ModMouseStateManager) { ((ModMouseStateManager)MouseState).ForceDisable = mouseInImGui; } if (KeyboardState is ModKeyboardStateManager) { ((ModKeyboardStateManager)KeyboardState).ForceDisable = keyboardInImGui; } ImGuiState.Render(); FNAHooks.SkipClear++; GraphicsDevice.SetRenderTargets(prevRT); TargetRenderingManager.DrawFullscreen(RT); }