Advertisement
Guest User

XNA

a guest
Feb 9th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.17 KB | None | 0 0
  1.  
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using Microsoft.Xna.Framework;
  7. using Microsoft.Xna.Framework.Audio;
  8. using Microsoft.Xna.Framework.Content;
  9. using Microsoft.Xna.Framework.GamerServices;
  10. using Microsoft.Xna.Framework.Graphics;
  11. using Microsoft.Xna.Framework.Input;
  12. using Microsoft.Xna.Framework.Media;
  13.  
  14. namespace WindowsGame2
  15. {
  16.     /// <summary>
  17.     /// This is the main type for your game
  18.     /// </summary>
  19.     public class Game1 : Microsoft.Xna.Framework.Game
  20.     {
  21.        
  22.         GraphicsDeviceManager graphics;
  23.         SpriteBatch spriteBatch;
  24.  
  25.         public Game1()
  26.         {
  27.             graphics = new GraphicsDeviceManager(this);
  28.             Content.RootDirectory = "Content";
  29.         }
  30.  
  31.         /// <summary>
  32.         /// Allows the game to perform any initialization it needs to before starting to run.
  33.         /// This is where it can query for any required services and load any non-graphic
  34.         /// related content.  Calling base.Initialize will enumerate through any components
  35.         /// and initialize them as well.
  36.         /// </summary>
  37.         protected override void Initialize()
  38.         {
  39.             // TODO: Add your initialization logic here
  40.  
  41.             base.Initialize();
  42.         }
  43.  
  44.         /// <summary>
  45.         /// LoadContent will be called once per game and is the place to load
  46.         /// all of your content.
  47.         /// </summary>
  48.         protected override void LoadContent()
  49.         {
  50.             // Create a new SpriteBatch, which can be used to draw textures.
  51.             spriteBatch = new SpriteBatch(GraphicsDevice);
  52.  
  53.             // TODO: use this.Content to load your game content here
  54.         }
  55.  
  56.         /// <summary>
  57.         /// UnloadContent will be called once per game and is the place to unload
  58.         /// all content.
  59.         /// </summary>
  60.         protected override void UnloadContent()
  61.         {
  62.             // TODO: Unload any non ContentManager content here
  63.         }
  64.  
  65.         /// <summary>
  66.         /// Allows the game to run logic such as updating the world,
  67.         /// checking for collisions, gathering input, and playing audio.
  68.         /// </summary>
  69.         /// <param name="gameTime">Provides a snapshot of timing values.</param>
  70.         protected override void Update(GameTime gameTime)
  71.         {
  72.             // Allows the game to exit
  73.             if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
  74.                 this.Exit();
  75.  
  76.             if (Keyboard.GetState().IsKeyDown(Keys.B))
  77.             {
  78.                 //Coś tutaj, ale chodzi o to, że ów metoda tak czy siak zwraca błąd
  79.             }
  80.            
  81.             // TODO: Add your update logic here
  82.  
  83.             base.Update(gameTime);
  84.         }
  85.  
  86.         /// <summary>
  87.         /// This is called when the game should draw itself.
  88.         /// </summary>
  89.         /// <param name="gameTime">Provides a snapshot of timing values.</param>
  90.         protected override void Draw(GameTime gameTime)
  91.         {
  92.             GraphicsDevice.Clear(Color.CornflowerBlue);
  93.  
  94.             // TODO: Add your drawing code here
  95.  
  96.             base.Draw(gameTime);
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement