Xna3.0 windows game

來源:互聯網
上載者:User

 

 

 

using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using Microsoft.Xna.Framework;<br />using Microsoft.Xna.Framework.Audio;<br />using Microsoft.Xna.Framework.Content;<br />using Microsoft.Xna.Framework.GamerServices;<br />using Microsoft.Xna.Framework.Graphics;<br />using Microsoft.Xna.Framework.Input;<br />using Microsoft.Xna.Framework.Media;<br />using Microsoft.Xna.Framework.Net;<br />using Microsoft.Xna.Framework.Storage;</p><p>namespace WindowsGame1<br />{<br /> /// <summary><br /> /// This is the main type for your game<br /> /// </summary><br /> public class Game1 : Microsoft.Xna.Framework.Game<br /> {<br /> GraphicsDeviceManager graphics;<br /> SpriteBatch spriteBatch;</p><p> public Game1()<br /> {<br /> graphics = new GraphicsDeviceManager(this);<br /> Content.RootDirectory = "Content";<br /> }</p><p> /// <summary><br /> /// Allows the game to perform any initialization it needs to before starting to run.<br /> /// This is where it can query for any required services and load any non-graphic<br /> /// related content. Calling base.Initialize will enumerate through any components<br /> /// and initialize them as well.<br /> /// </summary><br /> protected override void Initialize()<br /> {<br /> // TODO: Add your initialization logic here</p><p> base.Initialize();<br /> }</p><p> /// <summary><br /> /// LoadContent will be called once per game and is the place to load<br /> /// all of your content.<br /> /// </summary><br /> protected override void LoadContent()<br /> {<br /> // Create a new SpriteBatch, which can be used to draw textures.<br /> spriteBatch = new SpriteBatch(GraphicsDevice);</p><p> // TODO: use this.Content to load your game content here<br /> }</p><p> /// <summary><br /> /// UnloadContent will be called once per game and is the place to unload<br /> /// all content.<br /> /// </summary><br /> protected override void UnloadContent()<br /> {<br /> // TODO: Unload any non ContentManager content here<br /> }</p><p> /// <summary><br /> /// Allows the game to run logic such as updating the world,<br /> /// checking for collisions, gathering input, and playing audio.<br /> /// </summary><br /> /// <param name="gameTime">Provides a snapshot of timing values.</param><br /> protected override void Update(GameTime gameTime)<br /> {<br /> // Allows the game to exit<br /> if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)<br /> this.Exit();</p><p> // TODO: Add your update logic here</p><p> base.Update(gameTime);<br /> }</p><p> /// <summary><br /> /// This is called when the game should draw itself.<br /> /// </summary><br /> /// <param name="gameTime">Provides a snapshot of timing values.</param><br /> protected override void Draw(GameTime gameTime)<br /> {<br /> GraphicsDevice.Clear(Color.CornflowerBlue);</p><p> // TODO: Add your drawing code here</p><p> base.Draw(gameTime);<br /> }<br /> }<br />}<br />

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.