2D游戏图形库的建议(PC)
我正在尝试将基础设置为具有可破坏地形和/或粒子效果、滚动、缩放、角色等的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用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.