Advertisement
Guest User

Untitled

a guest
May 4th, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using Microsoft.Xna.Framework;
  2. using Microsoft.Xna.Framework.Graphics;
  3.  
  4. namespace ProgrammingMonoGameTutorial
  5. {
  6.     public class Sprite
  7.     {
  8.         public Texture2D Texture { get; set; } = null;
  9.  
  10.         public Vector2 Position { get; set; } = Vector2.Zero;
  11.  
  12.         public Vector2 Origin { get; set; } = Vector2.Zero;
  13.  
  14.         public Vector2 Scale { get; set; } = Vector2.One;
  15.  
  16.         public float Roation { get; set; } = 0;
  17.  
  18.         public float Layer { get; set; } = 0;
  19.  
  20.         public Rectangle SourceRectangle { get; set; } = Rectangle.Empty;
  21.  
  22.         public Rectangle DestinationRectangle { get; set; } = Rectangle.Empty;
  23.  
  24.         public Color Hue { get; set; } = Color.White;
  25.  
  26.         public SpriteEffects Effect { get; set; } = SpriteEffects.None;
  27.  
  28.         public Sprite(Texture2D t)
  29.         {
  30.             Texture = t;
  31.             SourceRectangle = Texture.Bounds;
  32.         }
  33.  
  34.         public Sprite() { }
  35.  
  36.         public void Draw(SpriteBatch batch)
  37.         {
  38.             if(Texture != null)
  39.                 batch.Draw(Texture, Position, SourceRectangle, Hue, Roation, Origin, Scale, Effect, Layer);
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement