Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. #region Using Statements
  2. using System;
  3. using Microsoft.Xna.Framework;
  4. using Microsoft.Xna.Framework.Graphics;
  5. using Microsoft.Xna.Framework.Storage;
  6. using Microsoft.Xna.Framework.Input;
  7.  
  8. #endregion
  9. namespace GameTest2
  10. {
  11. /// <summary>
  12. /// This is the main type for your game
  13. /// </summary>
  14. public class Game1 : Game
  15. {
  16. GraphicsDeviceManager graphics;
  17. SpriteBatch spriteBatch;
  18.  
  19. Texture2D marioTexture;
  20.  
  21.  
  22. public Game1 ()
  23. {
  24. graphics = new GraphicsDeviceManager (this);
  25. Content.RootDirectory = "Content";
  26. graphics.IsFullScreen = true;
  27. }
  28.  
  29. /// <summary>
  30. /// Allows the game to perform any initialization it needs to before starting to run.
  31. /// This is where it can query for any required services and load any non-graphic
  32. /// related content. Calling base.Initialize will enumerate through any components
  33. /// and initialize them as well.
  34. /// </summary>
  35. protected override void Initialize ()
  36. {
  37. // TODO: Add your initialization logic here
  38. base.Initialize ();
  39.  
  40. }
  41.  
  42. /// <summary>
  43. /// LoadContent will be called once per game and is the place to load
  44. /// all of your content.
  45. /// </summary>
  46. protected override void LoadContent ()
  47. {
  48. // Create a new SpriteBatch, which can be used to draw textures.
  49. spriteBatch = new SpriteBatch (GraphicsDevice);
  50.  
  51. marioTexture = Content.Load<Texture2D>("retromario");
  52.  
  53. //TODO: use this.Content to load your game content here
  54. }
  55.  
  56. /// <summary>
  57. /// Allows the game to run logic such as updating the world,
  58. /// checking for collisions, gathering input, and playing audio.
  59. /// </summary>
  60. /// <param name="gameTime">Provides a snapshot of timing values.</param>
  61. protected override void Update (GameTime gameTime)
  62. {
  63. KeyboardState KeyState = Keyboard.GetState ();
  64. // For Mobile devices, this logic will close the Game when the Back button is pressed
  65. if (GamePad.GetState (PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
  66. {
  67. Exit ();
  68. }
  69. else if (KeyState.IsKeyDown (Keys.Escape))
  70. {
  71. Exit ();
  72. }
  73.  
  74.  
  75. // TODO: Add your update logic here
  76. position.X = 100;
  77. position.Y = 100;
  78.  
  79. base.Update (gameTime);
  80.  
  81. }
  82.  
  83. /// <summary>
  84. /// This is called when the game should draw itself.
  85. /// </summary>
  86. /// <param name="gameTime">Provides a snapshot of timing values.</param>
  87. protected override void Draw (GameTime gameTime)
  88. {
  89. graphics.GraphicsDevice.Clear (Color.CornflowerBlue);
  90.  
  91. //spriteBatch.Begin ();
  92. //spriteBatch.Draw (marioTexture, position, Color.White);
  93. //spriteBatch.End ();
  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