Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  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.  
  12. namespace WindowsGame1
  13. {
  14. /// <summary>
  15. /// This is the main type for your game
  16. /// </summary>
  17. public class Game1 : Microsoft.Xna.Framework.Game
  18. {
  19. GraphicsDeviceManager graphics;
  20. SpriteBatch spriteBatch ;
  21.  
  22. Bird _Bird = new Bird();
  23.  
  24. Texture2D _Birdtexture;
  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. // TODO: use this.Content to load your game content here
  55. _Birdtexture = Content.Load<Texture2D>("Bird");
  56.  
  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 (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
  77. this.Exit();
  78.  
  79. // TODO: Add your update logic here
  80.  
  81. base.Update(gameTime);
  82. }
  83.  
  84. /// <summary>
  85. /// This is called when the game should draw itself.
  86. /// </summary>
  87. /// <param name="gameTime">Provides a snapshot of timing values.</param>
  88. protected override void Draw(GameTime gameTime)
  89. {
  90. GraphicsDevice.Clear(Color.CornflowerBlue);
  91.  
  92. // TODO: Add your drawing code here
  93. spriteBatch.Begin();
  94. spriteBatch.Draw(_Birdtexture, _Bird.Location, Color.White);
  95. spriteBatch.End();
  96.  
  97. base.Draw(gameTime);
  98. }
  99. }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement