在 C# Visual Studio 2008 中用于 2D 游戏的最佳模板是什么?

发布于 2024-09-17 12:39:38 字数 88 浏览 3 评论 0原文

是 WPF 吗?世界足联?自定义模板? 我目前使用 WFA,但它似乎远没有达到最佳效果。不,我并不是要求推荐 DirectX 或其他语言。

谢谢。

Is it WPF? WFA? A custom template?
I currently use WFA, and it just doesn't seem anywhere near optimal. And no, I'm not asking for a referral to DirectX, or another language.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

方觉久 2024-09-24 12:39:38

您想要真正的 2D 游戏,还是想要一款 3D 对象在 2D 中移动的“2.5D”游戏?

对于大多数基本的 2D,例如回合制游戏或简单动画,不需要非常精细的人工输入控制,WFA 中使用的 System.Drawing 工具可能就足够了。您可以使用很多技巧,例如使用小图像作为精灵、渲染矢量图形以及必备的基本形状绘制功能。您可以使用位图之类的图像对象来模拟翻页(创建位图,在其上绘制形状,然后调用 Graphics.DrawImage()),或者仅在用作图形窗格的控件上使用 SetRedraw(false)在绘制下一个窗口时冻结那里的内容。

WPF 有一些工具是一次重大飞跃。查看System.Windows.Media.Media3D命名空间;它具有用于 3D 矢量代数和几何基元的工具,允许您使用顶点着色和所有技巧创建 2.5D 游戏。可以引用和使用基本结构的数学功能,或者您可以构建一个 WPF 应用程序将它们集成到图形窗格中。你必须自己研究一下;我是 WPF 的轻量级人员。

如果您希望游戏真正获得一定的 FPS,则必须使用 DirectX 等加速平台。 XNA Game Studio 是一个免费的 .NET 兼容 API,它包含许多 DirectX 功能,允许您创建具有加速图形的 .NET 应用程序,而无需混乱的本机代码连接。在几乎任何 .NET 兼容平台(包括 Windows)上创建和运行应用程序都是免费的;您必须付费并加入“XBox Creator Network”才能发布甚至免费的 Xbox 360 游戏。

Do you want it to be really 2D, or you you want a "2.5D" game where 3D objects move in 2D?

For most basic 2D, like turn-based games or simple animation where very fine human input control is not necessary, the System.Drawing tools used in a WFA will probably be fine. You have access to a lot of the tricks, like using small images as sprites, rendering vector graphics, as well as the must-have elementary shape-drawing functions. You can use Image objects like Bitmaps to simulate page-flipping (create a Bitmap, draw the shapes on it, then call Graphics.DrawImage()), or simply use SetRedraw(false) on the control you're using as the Graphics pane to freeze what's there while you're drawing the next window.

WPF has some tools that are a major leap forward. Look at the System.Windows.Media.Media3D namespace; it has tools for 3D vector algebra and geometric primitives, allowing you to create 2.5D games with vertex shading and all the tricks. The basic structs can be referenced and used for their mathematical power, or you can build a WPF application that will integrate them into a graphics pane. You'll have to research this yourself; I'm a lightwight with WPF.

If you want your game to really get some FPS, you're going to have to use an accelerated platform like DirectX. XNA Game Studio is a free .NET-compatible API that wraps a lot of the DirectX functionality, allowing you to create .NET apps with accelerated graphics without requiring messy native code hookups. Creating and running apps on just about any .NET-compatible platform (including Windows) is free; you have to pay a fee and join the "XBox Creator Network" to publish even free games for XBox 360.

挽你眉间 2024-09-24 12:39:38

XNA 和 Box2D.XNA 物理引擎(如果您的游戏需要 2D 碰撞检测和物理)。 XNA 负责向您隐藏所有疯狂的 DirectX 内容。它有一个很棒的内容管道,可以让您轻松地将内容添加到游戏中。我最喜欢的小游戏框架。

XNA, and the Box2D.XNA physics engine if your game requires 2D collision detection and physics. XNA takes care of hiding all that crazy DirectX stuff from you. It has a great content pipeline, which lets you add content to your game very easily. My favorite framework for small games.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文