Advertisement
Guest User

Sprite.cs

a guest
Sep 4th, 2023
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | Source Code | 0 0
  1. using Microsoft.Xna.Framework;
  2. using Microsoft.Xna.Framework.Graphics;
  3.  
  4. namespace DNM {
  5.     public class Sprite {
  6.         public Texture2D? texture;
  7.         public Vector2 position;
  8.         public int width;
  9.         public int height;
  10.  
  11.         public Sprite(GraphicsDevice graphicsDevice, Texture2D texture, int xPos, int yPos, int width, int height) {
  12.             this.texture = texture;
  13.             position = new Vector2(xPos, yPos);
  14.             this.width = width;
  15.             this.height = height;
  16.         }
  17.  
  18.         public void Draw(SpriteBatch spriteBatch, Color color) {
  19.             spriteBatch.Draw(texture, position, new Rectangle((int)position.X, (int)position.Y, width, height), color);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement