using Encompass; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using PongFE.Components; using PongFE.Extensions; namespace PongFE.Renderers { public class Texture2DRenderer : OrderedRenderer { private readonly SpriteBatch _spriteBatch; public Texture2DRenderer(SpriteBatch spriteBatch) { _spriteBatch = spriteBatch; } public override void Render(Entity entity, in Texture2DComponent textureComponent) { ref readonly var positionComponent = ref GetComponent(entity); _spriteBatch.Draw( textureComponent.Texture, positionComponent.Position.Truncated().ToXNAVector(), null, Color.White, 0, Vector2.Zero, Vector2.One, SpriteEffects.None, 0 ); } } }