【发布时间】:2011-09-13 06:12:43
【问题描述】:
我开始学习 XNA 并且进展顺利。但是我想知道我是否通过学习 3.1 而不是 4.0 来打自己的脚?
我知道有什么新功能:http://msdn.microsoft.com/en-us/library/bb417503.aspx,这似乎主要是电话、界面和视频功能 - 我对这些功能不太感兴趣 - 我更多的是做核心 3D 的东西。
症结是:我已经有Visual Studio 2008专业版,如果4.0的游戏编程差别不大,我不想再弄VS 2010了。
世界在前进吗?我在 3.1 中学习的内容会变得多余吗?
库中也有代码差异,但不是主要的,其中很多都可以在这里看到:http://www.nelxon.com/blog/xna-3-1-to-xna-4-0-cheatsheet/,例如与 Riemers Tut 相比我必须弄清楚的这个:
XNA 4.0
protected override void Draw(GameTime gameTime)
{
device.Clear(Color.DarkSlateBlue);
RasterizerState rs = new RasterizerState();
rs.CullMode = CullMode.None;
device.RasterizerState = rs;
effect.CurrentTechnique = effect.Techniques["ColoredNoShading"];
effect.Parameters["xView"].SetValue(viewMatrix);
effect.Parameters["xProjection"].SetValue(projectionMatrix);
effect.Parameters["xWorld"].SetValue(Matrix.Identity);
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
device.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration);
}
base.Draw(gameTime);
}
XNA 3.1
protected override void Draw(GameTime gameTime)
{
device.Clear(Color.DarkSlateBlue);
device.VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
device.RenderState.CullMode = CullMode.None; // TODO only for testing!
device.RenderState.FillMode = FillMode.Solid;
effect.CurrentTechnique = effect.Techniques["ColoredNoShading"];
effect.Parameters["xView"].SetValue(viewMatrix);
effect.Parameters["xProjection"].SetValue(projectionMatrix);
effect.Parameters["xWorld"].SetValue(Matrix.Identity);
effect.Begin();
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Begin();
device.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, vertices, 0, 5, indices, 0, indices.Length / 3);
pass.End();
}
effect.End();
base.Draw(gameTime);
}
【问题讨论】:
-
对于那些投票结束的人 - 我还能在哪里问这个编程问题?
-
如果此处关闭,请尝试在 GameDev Stack Exchange (gamedev.stackexchange.com) 上提问。
-
XNA 和 Visual Studio 是程序员常用的软件工具。根据常见问题解答,这与软件开发有关,不确定是否应该关闭。
-
我在gamedev上重新发布后自己标记了它:gamedev.stackexchange.com/questions/13518/…