#region File Description //----------------------------------------------------------------------------- // DebugManager.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion #region Using Statements using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Content; #endregion namespace PerformanceMeasuring.GameDebugTools { /// /// DebugManager class that holds graphics resources for debug /// public class DebugManager : DrawableGameComponent { // the name of the font to load private string debugFont; #region Properties /// /// Gets a sprite batch for debug. /// public SpriteBatch SpriteBatch { get; private set; } /// /// Gets white texture. /// public Texture2D WhiteTexture { get; private set; } /// /// Gets SpriteFont for debug. /// public SpriteFont DebugFont { get; private set; } #endregion #region Initialize public DebugManager(Game game, string debugFont) : base(game) { // Added as a Service. Game.Services.AddService(typeof(DebugManager), this); this.debugFont = debugFont; // This component doesn't need be call neither update nor draw. this.Enabled = false; this.Visible = false; } protected override void LoadContent() { // Load debug content. SpriteBatch = new SpriteBatch(GraphicsDevice); DebugFont = Game.Content.Load(debugFont); // Create white texture. WhiteTexture = new Texture2D(GraphicsDevice, 1, 1); Color[] whitePixels = new Color[] { Color.White }; WhiteTexture.SetData(whitePixels); base.LoadContent(); } #endregion } }