2D游戏图形库的建议(PC)

发布于 2024-09-27 17:08:16 字数 147 浏览 2 评论 0原文

我正在尝试将基础设置为具有可破坏地形和/或粒子效果、滚动、缩放、角色等的 2D 游戏...我想知道是否有一个图形库可以在这两个软件中支持这些功能和硬件加速(需要像素访问)。我尝试过 SDL(即使使用 DirectX 后端),但似乎硬件只能在全屏下完成其工作。我将不胜感激任何建议。

I'm trying to set base to a 2D game with destructible terrain and/or particle effects, scroll, zoom, characters, etc... I'd like to know if there is a graphics library that would support those things in both software and hardware acceleration (need pixel access). I've tried SDL (even with DirectX back-end), but it seems hardware does its job only in full screen. I'd appreciate any suggestion.

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

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

发布评论

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

评论(1

柒七 2024-10-04 17:08:16

使用OpenGL。也许通过另一个库,例如 SDL。我不知道为什么你不能让窗口硬件加速工作,这可能是一个平台问题(但这肯定是一个不同的问题)。

将投影矩阵设置为正交并使用其中一个轴(通常为 z)来组织“堆叠”元素。通过在显示子例程中进行适当的转换,您可以将 x/y 坐标与“传统”绘图对齐(即,左上角向下,而不是左下角向上)。

将图形元素构建为位图,将它们转换为纹理并在 OpenGL 矩形之上绘制它们。

Use OpenGL. Perhaps via another library e.g. SDL. I do not know why you can't get windowed HW acceleration working, it might be a platform thing (but it's certainly a different question).

Set the projection matrix to orthographic and use one of the axis (typically z) to organise 'stacking' elements. With an appropriate transformation in the display subroutine, you can align the x/y coordinates with "traditional" drawing (i.e., top-left down, rather than bottom-left up).

Build your graphical elements into bitmaps, convert them into textures and draw them on top of OpenGL Rects.

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