Esempio n. 1
0
        internal static void Log()
        {
            if (ImGui.Log.Enabled && ImGui.Log.LogStatus)
            {
                //Status logging is time consuming, so we lower down the fps by sleeping here.
                Thread.Sleep(40);
            }

            GUIContext g = Application.ImGuiContext;

            MainForm.Platform_SetWindowTitle(
                $"fps:{g.fps,5:0.0}," +
                $" mouse pos: {Mouse.Instance.Position}," +
                $" deltaTime: {g.DeltaTime}ms," +
                $" {g.DevOnly_GetNodeName(g.HoverId)}");

            var l = Application.Logger;

            if (ImGui.Log.Enabled && ImGui.Log.LogStatus)
            {
                WindowManager w = g.WindowManager;
                l.Clear();
                l.Msg("fps:{0,5:0.0}, mouse pos: {1}, deltaTime: {2}ms", g.fps, Mouse.Instance.Position, g.DeltaTime);
                l.Msg("Input");
                l.Msg("    LeftButtonState {0}", Mouse.Instance.LeftButtonState);
                l.Msg("    LeftButtonDownDuration {0}ms", Mouse.Instance.LeftButtonDownDuration);
                l.Msg("    LeftButtonPressed {0}, {1} times", Mouse.Instance.LeftButtonPressed, Mouse.Instance.LeftButtonPressedTimes);
                l.Msg("    LeftButtonReleased {0}, {1} times", Mouse.Instance.LeftButtonReleased, Mouse.Instance.LeftButtonReleasedTimes);
                l.Msg("    LeftButtonDoubleClicked {0}, {1} times", Mouse.Instance.LeftButtonDoubleClicked, Mouse.Instance.LeftButtonDoubleClickedTimes);

                l.Msg("ActiveId: {0}, ActiveIdIsAlive: {1}", g.ActiveId, g.ActiveIdIsAlive);
                l.Msg("HoverId: {0}", g.HoverId);

                l.Msg("Window:");
                l.Msg("    HoveredWindow: {0}", (w.HoveredWindow != null) ? w.HoveredWindow.ID.ToString() : "<none>");
                l.Msg("    MovingWindow: {0}", (w.MovingWindow != null) ? w.MovingWindow.ID.ToString() : "<none>");
                l.Msg("    Window List:");
                for (int i = 0; i < w.Windows.Count; i++)
                {
                    var window = w.Windows[i];
                    l.Msg($"        [{i}]:{window.Name}, active: {window.Active}, rect: {window.Rect}");
                }
            }
        }