// ==================================================================== Draw in Debug Window === public void OnDebugWindow(DebugWindow dw) { if (ImGui.TreeNode("BallMonitor", string.Format("Balls ({0})", Counter))) { if (ImGui.Button("Add ball")) { dw.VPE.CreateBall(); } #if UNITY_EDITOR if (ImGuiExt.InlineButton("Add ball & Pause")) { dw.VPE.CreateBall(); EditorApplication.isPaused = true; } #endif if (ImGuiExt.InlineButton("Add ball in lane")) { dw.VPE.CreateBall(900, 1200); } ImGui.TreePop(); } }
public void Draw() { _ProcessKeyboardInput(); const float DISTANCE = 10.0f; var io = ImGui.GetIO(); var window_pos = new Vector2((_corner & 1) != 0 ? io.DisplaySize.x - DISTANCE : DISTANCE, (_corner & 2) != 0 ? io.DisplaySize.y - DISTANCE : DISTANCE); var window_pos_pivot = new Vector2((_corner & 1) != 0 ? 1.0f : 0.0f, (_corner & 2) != 0 ? 1.0f : 0.0f); ImGui.SetNextWindowPos(window_pos, ImGuiCond.Always, window_pos_pivot); ImGui.SetNextWindowBgAlpha(0.35f); // Transparent background if (ImGui.Begin("Simple overlay", ref _debugUI.showOverlayWindow, (_corner != -1 ? ImGuiWindowFlags.NoMove : 0) | ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav)) { var pm = _debugUI.Performance; if (_showPerformanceCharts) { ImGui.PushItemWidth(-1); // remove space saved for label pm.Fps.Draw("FPS: "); pm.PhysicsTicks.Draw("Physics: "); pm.PhysicsTimes.Draw("", "Physics time: ", "n1"); ImGui.PopItemWidth(); } else { pm.Fps.Draw("FPS: ", _showPerformanceCharts); } if (ImGuiExt.Button("F6", "Press F6 to spawn ball at cursor")) { _debugUI.VPE.CreateBall(); } if (ImGuiExt.Button("F7", "Press F7 to enable manual ball roller", _enableManualBallRoller ? 0.35f : 0.0f)) { _enableManualBallRoller = !_enableManualBallRoller; } if (ImGuiExt.Button("F8", "Press F8 to show/hide Debug Window", _debugUI.showDebugWindow ? 0.35f : 0.0f)) { _debugUI.showDebugWindow = !_debugUI.showDebugWindow; } if (ImGuiExt.Button("F9", "Press F9 to show/hide Performance Charts", _showPerformanceCharts ? 0.35f : 0.0f)) { _showPerformanceCharts = !_showPerformanceCharts; } if (ImGuiExt.Button("F10", "Press F10 to enable/disable FreeCam", _enableFreeCam ? 0.35f : 0.0f)) { _enableFreeCam = !_enableFreeCam; } if (_showPerformanceCharts) { if (ImGui.IsMousePosValid()) { ImGui.Text("Mouse Position: (" + io.MousePos.x.ToString("n1") + ", " + io.MousePos.y.ToString("n1") + ")"); } else { ImGui.Text("Mouse Position: <invalid>"); } } ImGui.Separator(); ImGui.Text("(right-click to change position)"); _RightButtonMenu(); } ImGui.End(); }