Sprite.cs 648 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Xna.Framework;
  7. using Microsoft.Xna.Framework.Graphics;
  8. namespace Tutorial025.Sprites
  9. {
  10. public class Sprite : Component
  11. {
  12. protected Texture2D _texture;
  13. public Vector2 Position;
  14. public Sprite(Texture2D texture)
  15. {
  16. _texture = texture;
  17. }
  18. public override void Update(GameTime gameTime)
  19. {
  20. }
  21. public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
  22. {
  23. spriteBatch.Draw(_texture, Position, Color.White);
  24. }
  25. }
  26. }