public DiagnosticHud(DrawingFont font, DiagnosticHudConfiguration configuration = null)
        {
            this.font = font;
            this.configuration = configuration ?? new DiagnosticHudConfiguration();

            this.finalLines = new List<string>();
            this.fpsLine = new LineConfiguration
            {
                Template = "FPS {0:d} - Update Per Second {1:d}",
                ParameterProviders = new List<Func<object>>
                {
                    () => this.currentGameTime.DrawFps,
                    () => this.currentGameTime.UpdateFps
                }
            };

            this.ViewState = this.configuration.DisplayState;
        }
Example #2
0
        private DiagnosticHud CreateDiagnosticLayer()
        {
            var font = this.ResourceManager.GetDrawingFont(@"Sandbox\SpriteFont1");

            var configuration = new DiagnosticHudConfiguration(DiagnosticDisplayLocation.Left);
            configuration.EnableTouchTracking(this.InputConfiguration.CreateTouchTracking(this.Camera));

            configuration.AddLine("DoubleTap: {0}", () => this.doubleTapCount);
            configuration.AddLine("DragComplete: {0}", () => this.dragCompleteCount);
            configuration.AddLine("Flick: {0}", () => this.flickCount);
            configuration.AddLine("FreeDrag: {0}", () => this.freeDragCount);
            configuration.AddLine("Hold: {0}", () => this.holdCount);
            configuration.AddLine("HorizontalDrag: {0}", () => this.horizontalDragCount);
            configuration.AddLine("PinchCompleted: {0}", () => this.pinchCompleteCount);
            configuration.AddLine("Pinch: {0}", () => this.pinchCount);
            configuration.AddLine("Tap: {0}", () => this.tapCount);
            configuration.AddLine("VerticalDrag: {0}", () => this.verticalDragCount);

            this.diagnosticHud = new DiagnosticHud(font, configuration);

            return this.diagnosticHud;
        }
        private DiagnosticHud CreateDiagnosticLayer()
        {
            var font = this.ResourceManager.GetDrawingFont(@"Sandbox\SpriteFont1");

            var config = new DiagnosticHudConfiguration();
            config.EnableCameraTracking(this.Camera);
            config.EnableKeyboardTracking(this.InputConfiguration.CreateKeyboardTracking());
            config.EnableMouseTracking(this.InputConfiguration.CreateMouseTracking(this.Camera));
            config.EnableHitTracking(() => this.hits);
            config.AddLine("Range: {0:f1}", () => this.range);
            config.AddLine("Objects: {0} (drawn: {1})",
                () => this.layer.TotalElements, () => this.layer.DrawnElementsLastFrame);

            this.diagnosticHud = new DiagnosticHud(font, config);

            return this.diagnosticHud;
        }