コード例 #1
0
        void CreatePerformanceGraph()
        {
            var minSize = new Vector2(100, 16);
            var size    = Vector2.Max(minSize, Config.PerformanceGraphConfig.Size);

            PerformanceGraph = new PerformanceGraph(this, Config.PerformanceGraphConfig, size);

            PerformanceGraph.Visible = Config.PerformanceGraphConfig.Visible;

            PerformanceGraph.VisibleChanged += (sender, args) => {
                Config.PerformanceGraphConfig.Visible = PerformanceGraph.Visible;
            };

            PerformanceGraph.TitleBar.Dragged += (object sender, ref Vector2 args) =>
            {
                Config.PerformanceGraphConfig.Position = PerformanceGraph.Position;
            };

            PerformanceGraph.Dragged += (object sender, ref Vector2 args) =>
            {
                Config.PerformanceGraphConfig.Position = PerformanceGraph.Position;
            };

            PerformanceGraph.ScaleNob.Dragged += (object sender, ref Vector2 args) =>
            {
                Config.PerformanceGraphConfig.Size = PerformanceGraph.Size;
            };
        }
コード例 #2
0
        public override void Draw(GameTime gameTime)
        {
            // Reset update count.
            Interlocked.Exchange(ref _updateCount, 0);

            TimeRuler.Draw(_prevLog);
            PerformanceGraph.Draw(_internalLabeler, _prevLog);
            ProfilerSummary.Draw(_internalLabeler, _prevLog);
        }
コード例 #3
0
        public ProfilerManager(IUserInterface userInterface)
            : base(GearsetSettings.Instance.ProfilerConfig)
        {
            _userInterface = userInterface;
            _userInterface.CreateProfiler(Config, 0, 0, 0);
            _userInterface.LevelItemChanged += (sender, args) =>
            {
                switch (args.Name)
                {
                case "TimeRuler":
                    TimeRuler.SetLevel(args.LevelId, args.Enabled);
                    Config.TimeRulerConfig.VisibleLevelsFlags = TimeRuler.VisibleLevelsFlags;
                    break;

                case "PerformanceGraph":
                    PerformanceGraph.SetLevel(args.LevelId, args.Enabled);
                    Config.PerformanceGraphConfig.VisibleLevelsFlags = PerformanceGraph.VisibleLevelsFlags;
                    break;

                case "ProfilerSummary":
                    ProfilerSummary.SetLevel(args.LevelId, args.Enabled);
                    Config.ProfilerSummaryConfig.VisibleLevelsFlags = ProfilerSummary.VisibleLevelsFlags;
                    break;
                }
            };

            RefreshSummary = true;

            LineDrawer = new InternalLineDrawer(64);
            Children.Add(LineDrawer);

            Children.Add(_internalLabeler);
            Children.Add(TempBoxDrawer);

            _logs = new FrameLog[2];
            for (var i = 0; i < _logs.Length; ++i)
            {
                _logs[i] = new FrameLog();
            }

            CreateTimeRuler();
            CreatePerformanceGraph();
            CreateProfilerSummary();
        }