Advertisement
tsinclai2002

MonoGame Hello World Pun

Jan 15th, 2014
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.91 KB | None | 0 0
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // MyFirstMonoGameGame.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9.  
  10. #region Using Statements
  11. using System;
  12.  
  13. using Microsoft.Xna.Framework;
  14. using Microsoft.Xna.Framework.Audio;
  15. using Microsoft.Xna.Framework.Graphics;
  16. using Microsoft.Xna.Framework.Input;
  17. using Microsoft.Xna.Framework.Input.Touch;
  18. using Microsoft.Xna.Framework.Storage;
  19. using Microsoft.Xna.Framework.Content;
  20. using Microsoft.Xna.Framework.Media;
  21.  
  22. #endregion
  23.  
  24. namespace MyFirstMonoGame
  25. {
  26.     /// <summary>
  27.     /// Default Project Template
  28.     /// </summary>
  29.     public class Game1 : Game
  30.     {
  31.  
  32.     #region Fields
  33.         GraphicsDeviceManager graphics;
  34.         SpriteBatch spriteBatch;
  35.         Texture2D hello_tstTexture;
  36.         Texture2D earthTexture;
  37.     #endregion
  38.  
  39.     #region Initialization
  40.  
  41.         public Game1()  
  42.         {
  43.  
  44.             graphics = new GraphicsDeviceManager(this);
  45.            
  46.             Content.RootDirectory = "Content";
  47.  
  48.             graphics.IsFullScreen = false;
  49.         }
  50.  
  51.         /// <summary>
  52.         /// Overridden from the base Game.Initialize. Once the GraphicsDevice is setup,
  53.         /// we'll use the viewport to initialize some values.
  54.         /// </summary>
  55.         protected override void Initialize()
  56.         {
  57.             base.Initialize();
  58.         }
  59.  
  60.  
  61.         /// <summary>
  62.         /// Load your graphics content.
  63.         /// </summary>
  64.         protected override void LoadContent()
  65.         {
  66.             // Create a new SpriteBatch, which can be use to draw textures.
  67.             spriteBatch = new SpriteBatch(graphics.GraphicsDevice);
  68.            
  69.             // TODO: use this.Content to load your game content here eg.
  70.             hello_tstTexture = Content.Load<Texture2D>("hello_tst");
  71.             earthTexture = Content.Load<Texture2D> ("earth");
  72.         }
  73.  
  74.     #endregion
  75.  
  76.     #region Update and Draw
  77.  
  78.         /// <summary>
  79.             /// Allows the game to run logic such as updating the world,
  80.             /// checking for collisions, gathering input, and playing audio.
  81.             /// </summary>
  82.             /// <param name="gameTime">Provides a snapshot of timing values.</param>
  83.         protected override void Update(GameTime gameTime)
  84.         {
  85.             // TODO: Add your update logic here        
  86.                    
  87.             base.Update(gameTime);
  88.         }
  89.  
  90.         /// <summary>
  91.         /// This is called when the game should draw itself.
  92.         /// </summary>
  93.         /// <param name="gameTime">Provides a snapshot of timing values.</param>
  94.         protected override void Draw(GameTime gameTime)
  95.         {
  96.             // Clear the backbuffer
  97.             graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
  98.  
  99.             spriteBatch.Begin();
  100.  
  101.             // draw the hello_tst
  102.             spriteBatch.Draw(hello_tstTexture, new Vector2 (130, 200), Color.White);
  103.             spriteBatch.Draw(earthTexture, new Vector2 (400, 200), Color.White);
  104.  
  105.             spriteBatch.End();
  106.  
  107.             //TODO: Add your drawing code here
  108.             base.Draw(gameTime);
  109.         }
  110.  
  111.     #endregion
  112.     }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement