Advertisement
Guest User

Untitled

a guest
May 4th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using Microsoft.Xna.Framework;
  2. using Microsoft.Xna.Framework.Graphics;
  3. using Microsoft.Xna.Framework.Input;
  4.  
  5. namespace ProgrammingMonoGameTutorial
  6. {
  7.     public class Game1 : Game
  8.     {
  9.         GraphicsDeviceManager graphics;
  10.         SpriteBatch spriteBatch;
  11.         Texture2D image;
  12.         Sprite sprite;
  13.  
  14.         public Game1()
  15.         {
  16.             graphics = new GraphicsDeviceManager(this);
  17.             Content.RootDirectory = "Content";
  18.         }
  19.  
  20.         protected override void LoadContent()
  21.         {
  22.             spriteBatch = new SpriteBatch(GraphicsDevice);
  23.             image = Content.Load<Texture2D>("cat"); //just the image name
  24.             sprite = new Sprite(image);
  25.         }
  26.  
  27.         protected override void Update(GameTime gameTime) { }
  28.  
  29.         protected override void Draw(GameTime gameTime)
  30.         {
  31.             GraphicsDevice.Clear(Color.CornflowerBlue);
  32.             spriteBatch.Begin();
  33.             sprite.Draw(spriteBatch);
  34.             spriteBatch.End();
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement