XNA in VS2010

This is the way for VS2010 to use XNA but first u must install VS2008 , XNA 3.1, VS2010 in ur machine.

there are some notes that the main chunk of what you won’t have:

1) You won’t have the content pipeline. If you want to build content, you’ll have to use VS2008 or an external tool.

2) You won’t have deploy for Xbox 360 or Zune. If you want to build an Xbox or Zune game, use VS2008.

Ok,Lets begin:

1) Create a new C# Console Application in VS2010.

2) Right click your project and choose Add References. 3) Scroll through the list of .NET references to find Microsoft.Xna.Frameworkand Microsoft.Xna.Framework.Game and add those to your project.

4) Decide whether you want to build for .NET 4.0 (the new CLR) or .NET 2.0/3.0/3.5 (the old CLR). To choose, right click your project and choose Properties. Then change the Target Framework drop down. 5) In your project properties, change the Output Type to Windows Application.

6) If you’re building against .NET 4.0, you need to add an Application Configuration file to your project. It’s a template in the Add New Item menu for adding files. Be sure to leave the name “App.config”.

Replace the text in the default file with this:

 

Code
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3.    <startup useLegacyV2RuntimeActivationPolicy="true">
  4.       <supportedRuntime version="v4.0"/>
  5.    </startup>
  6. </configuration>

 

This lets you use V2 runtime assemblies (like the XNA Framework) in a project compiled against the new CLR.

7) Now just build your game. For instance, you could delete Program.cs and add a Game1.cs with this contents:
Code
  1. using Microsoft.Xna.Framework;
  2. using Microsoft.Xna.Framework.Graphics;
  3.  
  4. namespace MyWindowsGame
  5. {
  6.    class Game1 : Game
  7.    {
  8.       public Game1()
  9.       {
  10.          new GraphicsDeviceManager(this);
  11.       }
  12.  
  13.       protected override void Draw(GameTime gameTime)
  14.       {
  15.          GraphicsDevice.Clear(Color.CornflowerBlue);
  16.          base.Draw(gameTime);
  17.       }
  18.  
  19.       static void Main(string[] args)
  20.       {
  21.          using (Game1 game = new Game1())
  22.          {
  23.             game.Run();
  24.          }
  25.       }
  26.    }
  27. }
  28.  
 
Which when run gives you the wonderful default CornflowerBlue:
And there you go. You’re off the ground and running building with XNA Framework and VS2010. Have fun.

 

您可能会对以下文章感兴趣:

Loading…

七月 25th, 2010 我来说两句
首页 > 编程技巧 > XNA in VS2010
  1. 七月 29th, 2010 at 01:05 | #1

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE comment_approved =1 AND comment_author_email !='qzliuyuzou@gmail.com' ' at line 3]
    SELECT comment_author,comment_author_email,comment_author_url,count( comment_author_email ) AS cmtcount FROM WHERE comment_approved =1 AND comment_author_email !='qzliuyuzou@gmail.com' AND comment_type = '' AND TO_DAYS( now( ) )-TO_DAYS(`comment_date`)<30 GROUP BY comment_author_email ORDER BY cmtcount DESC LIMIT 0 ,1500

    全英文啊,看着 :roll:

    [回复]

    小鬼 NEW ZEALAND Windows NT Google Chrome 5.0.375.99 回复:

    @LAONB, 呵呵,直接用Google翻译就好了 8)

    [回复]

  2. 八月 3rd, 2010 at 12:39 | #2

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE comment_approved =1 AND comment_author_email !='qzliuyuzou@gmail.com' ' at line 3]
    SELECT comment_author,comment_author_email,comment_author_url,count( comment_author_email ) AS cmtcount FROM WHERE comment_approved =1 AND comment_author_email !='qzliuyuzou@gmail.com' AND comment_type = '' AND TO_DAYS( now( ) )-TO_DAYS(`comment_date`)<30 GROUP BY comment_author_email ORDER BY cmtcount DESC LIMIT 0 ,1500

    直接谷歌了

    [回复]

  3. 八月 29th, 2010 at 05:00 | #3

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE comment_approved =1 AND comment_author_email !='qzliuyuzou@gmail.com' ' at line 3]
    SELECT comment_author,comment_author_email,comment_author_url,count( comment_author_email ) AS cmtcount FROM WHERE comment_approved =1 AND comment_author_email !='qzliuyuzou@gmail.com' AND comment_type = '' AND TO_DAYS( now( ) )-TO_DAYS(`comment_date`)<30 GROUP BY comment_author_email ORDER BY cmtcount DESC LIMIT 0 ,1500

    VS2010,上次装了放我电脑没用后就删了……唉,还是老老实实的用我的VB 6.0吧…… :oops:

    [回复]

  4. 八月 30th, 2010 at 12:11 | #4

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE comment_approved =1 AND comment_author_email !='qzliuyuzou@gmail.com' ' at line 3]
    SELECT comment_author,comment_author_email,comment_author_url,count( comment_author_email ) AS cmtcount FROM WHERE comment_approved =1 AND comment_author_email !='qzliuyuzou@gmail.com' AND comment_type = '' AND TO_DAYS( now( ) )-TO_DAYS(`comment_date`)<30 GROUP BY comment_author_email ORDER BY cmtcount DESC LIMIT 0 ,1500

    全是英文呢,看来这里我也只能是走一走了
    学夫子在他的blog中写下的美文 >> ๑۩۞۩๑ 数学给我们的启示——爱的施舍๑۩۞۩๑ My ComLuv Profile

    [回复]

:wink: :twisted: :siluo: :roll: :oops: :love: :lol: :evil: :cry: :-| :-x :-? :) :( 8)
您可以选择是否显示您的某一篇日志

可以使用的Html标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">
Trackbacks (0 ) 详情 Trackback