SHARE
TWEET

Untitled

a guest Jun 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Microsoft.Xna.Framework;
  5. using Microsoft.Xna.Framework.Audio;
  6. using Microsoft.Xna.Framework.Content;
  7. using Microsoft.Xna.Framework.GamerServices;
  8. using Microsoft.Xna.Framework.Graphics;
  9. using Microsoft.Xna.Framework.Input;
  10. using Microsoft.Xna.Framework.Media;
  11. using Microsoft.Xna.Framework.Net;
  12. using Microsoft.Xna.Framework.Storage;
  13.  
  14. namespace TutorialProject
  15. {
  16.     /// <summary>
  17.     /// This is the main type for your game
  18.     /// </summary>
  19.     public class Game1 : Microsoft.Xna.Framework.Game
  20.     {
  21.         GraphicsDeviceManager graphics;
  22.         SpriteBatch spriteBatch;
  23.         Texture2D labda;
  24.  
  25.  
  26.         public Game1()
  27.         {
  28.             graphics = new GraphicsDeviceManager(this);
  29.             Content.RootDirectory = "Content";
  30.         }
  31.  
  32.         /// <summary>
  33.         /// Allows the game to perform any initialization it needs to before starting to run.
  34.         /// This is where it can query for any required services and load any non-graphic
  35.         /// related content.  Calling base.Initialize will enumerate through any components
  36.         /// and initialize them as well.
  37.         /// </summary>
  38.         protected override void Initialize()
  39.         {
  40.             // TODO: Add your initialization logic here
  41.  
  42.             base.Initialize();
  43.         }
  44.  
  45.         /// <summary>
  46.         /// LoadContent will be called once per game and is the place to load
  47.         /// all of your content.
  48.         /// </summary>
  49.         protected override void LoadContent()
  50.         {
  51.             // Create a new SpriteBatch, which can be used to draw textures.
  52.             spriteBatch = new SpriteBatch(GraphicsDevice);
  53.  
  54.             labda = Content.Load<Texture2D>("labda");
  55.  
  56.             // TODO: use this.Content to load your game content here
  57.         }
  58.  
  59.         /// <summary>
  60.         /// UnloadContent will be called once per game and is the place to unload
  61.         /// all content.
  62.         /// </summary>
  63.         protected override void UnloadContent()
  64.         {
  65.             // TODO: Unload any non ContentManager content here
  66.         }
  67.  
  68.         /// <summary>
  69.         /// Allows the game to run logic such as updating the world,
  70.         /// checking for collisions, gathering input, and playing audio.
  71.         /// </summary>
  72.         /// <param name="gameTime">Provides a snapshot of timing values.</param>
  73.         protected override void Update(GameTime gameTime)
  74.         {
  75.             // Allows the game to exit
  76.             if (Keyboard.GetState().IsKeyDown(Keys.Escape))
  77.                 this.Exit();
  78.  
  79.             // TODO: Add your update logic here
  80.  
  81.             base.Update(gameTime);
  82.            
  83.         }
  84.  
  85.         /// <summary>
  86.         /// This is called when the game should draw itself.
  87.         /// </summary>
  88.         /// <param name="gameTime">Provides a snapshot of timing values.</param>
  89.         protected override void Draw(GameTime gameTime)
  90.         {
  91.             GraphicsDevice.Clear(Color.CornflowerBlue);
  92.  
  93.             spriteBatch.Begin();
  94.  
  95.             spriteBatch.Draw(labda, new Rectangle(390, 0, 62, 62), Color.White);
  96.  
  97.             spriteBatch.End();
  98.  
  99.             base.Draw(gameTime);
  100.         }
  101.     }
  102. }
RAW Paste Data
Want to get better at C#?
Learn to code C# in 2017
Top