使用 SDL 的对话框/消息框?

发布于 2024-12-08 02:21:54 字数 1539 浏览 3 评论 0原文

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

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

发布评论

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

评论(3

惜醉颜 2024-12-15 02:21:54

SDL 站点的库部分中列出了多个 GUI 库。

对于什么是有价值的,我查看了所有这些库并确定没有一个适合我的需求。我正在写我自己的。

There are several GUI libraries listed in the libraries section of the SDL site.

For what is worth, I looked at all those libs and decided none fit my needs. I'm writing my own.

枫以 2024-12-15 02:21:54

不完全是,据我所知你几乎必须:
1)使用图形基元编写自己的或
2) 为每个目标平台编写操作系统特定代码以打开对话窗口。

对于第一个选项,您没有提到您是使用 SDL 进行 2D 图形还是使用 OpenGL?如果您使用 OpenGL,我相信有可用的 GUI 库可以使用 OpenGL 原语创建 GUI 元素,我会尝试搜索“OpenGL GUI”。
如果您查找如何使用 SDL_ttf 渲染字体并进行操作,您可以使用它向显示器写入文本响应。

第二个选项要求您研究如何在您想要定位的每个平台上打开消息框,并使用 #ifdefs 来控制使用哪个平台。例如,如果您想要针对 Windows、OS X 和 Linux,则需要使用 Windows api、Cocoa 和 X11 编写 3 个对话框函数。

Not really, as far as I know you pretty much have to:
1) write your own using graphics primitives or
2) write OS specific code for each target platform to open a dialog window.

For the first option, you haven't mentioned if you are using SDL for 2D graphics or with OpenGL? If you are using OpenGL I believe there are GUI libraries available that use OpenGL primitives to create GUI elements, I'd try searching for "OpenGL GUI".
If you lookup how to render fonts with SDL_ttf and get that going you could write text responses to the display using that.

The second option requires you to research how to open a message box on each platform you want to target and use #ifdefs to control which one is used. For example if you want to target windows, OS X and Linux you'll need to write 3 dialogue box functions, using the windows api, Cocoa and X11.

安静被遗忘 2024-12-15 02:21:54

我是 sourceforge 上小文件对话框的作者。它是一个单一的 C 文件,只有五个函数调用,包括消息框和问题对话框。它没有主循环,可以轻松补充 SDL。

I am the author of tiny file dialogs on sourceforge. It is a single C file with just five function calls including message box and question dialog. It has no main loop and complement SDL easily.

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