using Encompass; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using PongFE.Components; using PongFE.Extensions; using SpriteFontPlus; namespace PongFE.Renderers { public class UITextRenderer : GeneralRenderer { private SpriteBatch SpriteBatch { get; } public UITextRenderer(SpriteBatch spriteBatch) { SpriteBatch = spriteBatch; } public override void Render() { foreach (ref readonly var entity in ReadEntities()) { ref readonly var uiTextComponent = ref GetComponent(entity); ref readonly var positionComponent = ref GetComponent(entity); SpriteBatch.DrawString( uiTextComponent.Font, uiTextComponent.Text, positionComponent.Position.ToXNAVector(), Color.White ); } } } }