public DebugRenderer(SpriteBatch spriteBatch, MainGame game) { this.SpriteBatch = spriteBatch; DebugFont = new MultiSizeSpriteFont(game, MultiSizeSpriteFontDefinition.Create(game, "Fonts\\DebugFont\\DebugFont").WithDefaultAvailableSizes()); DebugRectangle = new Texture2D(spriteBatch.GraphicsDevice, 1, 1); DebugRectangle.SetData(new[] { Color.White }); }
/// <summary> /// Render <paramref name="text"/> with <paramref name="textHeight"/> in game units /// </summary> /// <param name="font">font to use for the text</param> /// <param name="textHeight">height of text in game units (i.e meters)</param> /// <param name="text">text to render</param> /// <param name="color">color of text</param> public TextDisplayComponent(MultiSizeSpriteFont font, float textHeight, string text, Color?color = null, float layerDepth = 0f) { this.Text = text; this.color = color ?? Color.Crimson; this.font = font; this.textHeight = textHeight; // transform layerDepth from [-1, 1] to [1.0, 0] this.layerDepth = 0.5f - layerDepth * 0.5f; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> public virtual void LoadContent() { MainFont = new MultiSizeSpriteFont(Game, MultiSizeSpriteFontDefinition.Create(Game, "Fonts\\Grinched\\Grinched").WithDefaultAvailableSizes()); AddEntity(new Entity(this, EntityType.LayerIndependent, NonPositionalAudio)); }